FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour cValToStr() error *Fixed*
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

cValToStr() error *Fixed*

Posted: Wed Jun 18, 2014 02:17 AM
It has occur an error while TXBrwose need to convert TIMESTAMP field in MySql. I try TDolphin but some field is TIMESTAMP and got an error.
Code (fw): Select all Collapse
   Path and name: D:\FWH1305\download\TDolphin\download\testpag.exe (32 bits)
   Size: 2,680,320 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130903)
   FiveWin  Version: FWHX 13.11
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 1 secs 
   Error occurred at: 06/18/14, 09:10:07
   Error description: Error BASE/1118  Argument error: TTOC
   Args:
     [   1] = C   ...

Stack Calls
===========
   Called from:  => TTOC( 0 )
   Called from: .\source\function\VALTOSTR.PRG => CVALTOSTR( 95 )

Thank you for any help and idea.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: cValToStr() error

Posted: Thu Jun 19, 2014 12:37 AM
Mr Dutch

Please help me with the results of :
? oQry:FieldType( <ntimestampfield> )
? ValType( oQry:FieldGet( <timestamefield> ) )

If both results are 'T' then please make this modification:
Locate method SetColFromMySQL(...) in xbrowse.prg.
Please change the line
Code (fw): Select all Collapse
   CASE cType       == 'D'

as
Code (fw): Select all Collapse
   CASE cType       $ 'DT'


If in the above test,
? ValType( oQry:FieldGet( <timestamefield> ) )
returns 'C' instead of 'T', please insert these two lines just before "OTHERWISE"
Code (fw): Select all Collapse
CASE cType == 'T'
                  cType := 'C'

I shall be glad if you can respond early.

PS: Regret I am not able to test myself as my development PC is under maintenance.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: cValToStr() error

Posted: Thu Jun 19, 2014 06:51 AM
Dear Mr.Rao,

I've test the result ValType() of TimeStamp field as below
Code (fw): Select all Collapse
    cValType := valtype( oQry:FieldGet( 'rta_stamp' )) return "C"
   cValType := oQry:FieldType( 'rta_stamp' )    return "T"
   cValType := valtype( oQry:rta_stamp )        return "C"


It has no error when I modified TXBrowse as your mention below.

Thanks a lot Mr.Rao
nageswaragunupudi wrote:Mr Dutch

Please help me with the results of :
? oQry:FieldType( <ntimestampfield> )
? ValType( oQry:FieldGet( <timestamefield> ) )

If both results are 'T' then please make this modification:
Locate method SetColFromMySQL(...) in xbrowse.prg.
Please change the line
Code (fw): Select all Collapse
   CASE cType       == 'D'

as
Code (fw): Select all Collapse
   CASE cType       $ 'DT'


If in the above test,
? ValType( oQry:FieldGet( <timestamefield> ) )
returns 'C' instead of 'T', please insert these two lines just before "OTHERWISE"
Code (fw): Select all Collapse
CASE cType == 'T'
                  cType := 'C'

I shall be glad if you can respond early.

PS: Regret I am not able to test myself as my development PC is under maintenance.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: cValToStr() error *Fixed*

Posted: Thu Jun 19, 2014 08:35 AM

Dutch,

Did you just applied this ?

CASE cType $ 'DT'

thanks,

(Going to include it in FWH 14.06)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: cValToStr() error *Fixed*

Posted: Thu Jun 19, 2014 09:21 AM
Antonio Linares wrote:Dutch,

Did you just applied this ?

CASE cType $ 'DT'

thanks,

(Going to include it in FWH 14.06)

No.
Test results of Mr Dutch indicate that though Dolphin returns fiedtype as 'T', it actually returns a character value not DateTime value. So if Dolphin says the fieldtype is 'T', we should consider it as 'C'.
So the fix must be:
Code (fw): Select all Collapse
CASE cType == 'T'
     cType := 'C'
     nLen   := 19
Regards



G. N. Rao.

Hyderabad, India
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: cValToStr() error *Fixed*

Posted: Thu Jun 19, 2014 09:23 AM

Rao,

Thanks for the clarification :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion