From 117995844b724f706c83d56ca97b5fef38407cb8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 8 May 2009 05:34:27 +0000 Subject: [PATCH] 2009-05-08 07:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/tclass.prg * source/rtl/treport.prg * source/rtl/tpersist.prg + Added support for TIMESTAMP types. * source/rtl/tclass.prg % Using SWITCH in AddData()/AddClassData(). --- harbour/ChangeLog | 11 ++++++++- harbour/source/rtl/tclass.prg | 42 ++++++++++++++++++++------------- harbour/source/rtl/tpersist.prg | 3 +++ harbour/source/rtl/treport.prg | 10 +++++--- 4 files changed, 46 insertions(+), 20 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e67f98f90d..e0c974afd2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,15 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-08 07:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * source/rtl/tclass.prg + * source/rtl/treport.prg + * source/rtl/tpersist.prg + + Added support for TIMESTAMP types. + + * source/rtl/tclass.prg + % Using SWITCH in AddData()/AddClassData(). + 2009-05-08 01:36 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/xhb/stream.prg ! disabled call to HB_IsByRef(). Such function does not exist in Harbour @@ -40,7 +49,7 @@ 2009-05-07 19:59 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/rtl/tget.prg ! Fixed to check for ::cType != NIL before - each SWITCH ::cType statments. Thanks to Przemek + each SWITCH ::cType statements. Thanks to Przemek for pointing it out. * source/rtl/alert.prg diff --git a/harbour/source/rtl/tclass.prg b/harbour/source/rtl/tclass.prg index c25c42d855..083aabdd6b 100644 --- a/harbour/source/rtl/tclass.prg +++ b/harbour/source/rtl/tclass.prg @@ -71,8 +71,8 @@ * */ -/* NOTE: This .prg is also used by the debugger subsystem, - therefore we need this switch to avoid an infinite +/* NOTE: This .prg is also used by the debugger subsystem, + therefore we need this switch to avoid an infinite loop when launching it. [vszakats] */ #pragma DEBUGINFO=OFF @@ -310,21 +310,26 @@ STATIC FUNCTION Instance() STATIC PROCEDURE AddData( cData, xInit, cType, nScope, lNoinit ) - LOCAL c - DEFAULT lNoInit TO .F. DEFAULT nScope TO HB_OO_CLSTP_EXPORTED /* Default Init for Logical and numeric */ IF ! lNoInit .AND. cType != NIL .AND. xInit == NIL - c := Upper( Left( cType, 1 ) ) - IF c == "L" /* Logical */ + SWITCH Upper( Left( cType, 1 ) ) + CASE "L" /* Logical */ xInit := .F. - ELSEIF c $ "NI" /* Numeric or Integer */ + EXIT + CASE "I" /* Numeric or Integer */ + CASE "N" /* Numeric or Integer */ xInit := 0 - ELSEIF c == "D" /* Date */ + EXIT + CASE "D" /* Date */ xInit := hb_SToD() - ENDIF + EXIT + CASE "T" /* Timestamp */ + xInit := hb_SToT( "" ) + EXIT + ENDSWITCH ENDIF AAdd( QSelf():aDatas, { cData, xInit, cType, nScope } ) @@ -346,8 +351,6 @@ STATIC PROCEDURE AddMultiData( cType, xInit, nScope, aData, lNoInit ) STATIC PROCEDURE AddClassData( cData, xInit, cType, nScope, lNoInit ) - LOCAL c - DEFAULT lNoInit TO .F. DEFAULT nScope TO HB_OO_CLSTP_EXPORTED @@ -355,14 +358,21 @@ STATIC PROCEDURE AddClassData( cData, xInit, cType, nScope, lNoInit ) /* Default Init for Logical and numeric */ IF ! lNoInit .AND. cType != NIL .AND. xInit == NIL - c := Upper( Left( cType, 1 ) ) - IF c == "L" /* Logical */ + SWITCH Upper( Left( cType, 1 ) ) + CASE "L" /* Logical */ xInit := .F. - ELSEIF c $ "NI" /* Numeric or Integer */ + EXIT + CASE "I" /* Numeric or Integer */ + CASE "N" /* Numeric or Integer */ xInit := 0 - ELSEIF c == "D" /* Date */ + EXIT + CASE "D" /* Date */ xInit := hb_SToD() - ENDIF + EXIT + CASE "T" /* Timestamp */ + xInit := hb_SToT( "" ) + EXIT + ENDSWITCH ENDIF AAdd( QSelf():aClsDatas, { cData, xInit, cType, nScope } ) diff --git a/harbour/source/rtl/tpersist.prg b/harbour/source/rtl/tpersist.prg index 827c518b03..76d1209e1b 100644 --- a/harbour/source/rtl/tpersist.prg +++ b/harbour/source/rtl/tpersist.prg @@ -228,6 +228,9 @@ STATIC FUNCTION ValToText( uValue ) cText := DToS( uValue ) cText := "0d" + iif( Empty( cText ), "00000000", cText ) + CASE cType == "T" + cText := 't"' + hb_TSToStr( uValue, .T. ) + '"' + OTHERWISE cText := hb_ValToStr( uValue ) ENDCASE diff --git a/harbour/source/rtl/treport.prg b/harbour/source/rtl/treport.prg index 070ba20000..a6f13a0e0d 100644 --- a/harbour/source/rtl/treport.prg +++ b/harbour/source/rtl/treport.prg @@ -209,7 +209,7 @@ METHOD New( cFrmName, lPrinter, cAltFile, lNoConsole, bFor, bWhile, nNext, nReco err:subSystem := "FRMLBL" Eval( ErrorBlock(), err ) ELSE - /* NOTE: CA-Cl*pper does an RTrim() on the filename here, + /* NOTE: CA-Cl*pper does an RTrim() on the filename here, but in Harbour we're using _SET_TRIMFILENAME. */ IF Set( _SET_DEFEXTENSIONS ) hb_FNameSplit( cFRMName, NIL, NIL, @cExt ) @@ -1142,8 +1142,8 @@ METHOD LoadReportFile( cFrmFile ) CLASS HBReportForm */ METHOD GetExpr( nPointer ) CLASS HBReportForm - LOCAL nExprOffset - LOCAL nExprLength + LOCAL nExprOffset + LOCAL nExprLength LOCAL nOffsetOffset := 0 LOCAL cString := "" @@ -1314,6 +1314,8 @@ METHOD GetColumn( cFieldsBuffer, nOffset ) CLASS HBReportForm aColumn[ RCT_PICT ] := Replicate("X", aColumn[ RCT_WIDTH ]) CASE cType == "D" aColumn[ RCT_PICT ] := "@D" + CASE cType == "T" + aColumn[ RCT_PICT ] := "@T" CASE cType == "N" IF aColumn[ RCT_DECIMALS ] != 0 aColumn[ RCT_PICT ] := Replicate("9", aColumn[ RCT_WIDTH ] - aColumn[ RCT_DECIMALS ] -1) + "." + ; @@ -1377,6 +1379,8 @@ STATIC FUNCTION MakeAStr( uVar, cType ) DO CASE CASE Upper( cType ) == "D" cString := DToC( uVar ) + CASE Upper( cType ) == "T" + cString := hb_TToC( uVar ) CASE Upper( cType ) == "L" cString := iif( uVar, "T", "F" ) CASE Upper( cType ) == "N"