Hi Roger:
I talked to you before about my clipper app I want to convert to XBASE++ that uses the Flexfile arrays. You said you were able to use strings to emulate that structure. Do you have a tool or some code to work from?
Tim Kromholtz
Ziegler Lumber Company
Flexfile memo arrays workaround
Re: Flexfile memo arrays workaround
Tim -
The function DC_Ar2Str() will convert a multi-dimensional array to a string that can then be stored to a database field.
You then used DC_Str2Ar() to read the database field and convert it back to an array.
The function DC_Ar2Str() will convert a multi-dimensional array to a string that can then be stored to a database field.
You then used DC_Str2Ar() to read the database field and convert it back to an array.
Code: Select all
aDir := Directory()
REPLACE MYDATABASE->directory WITH DC_Ar2Str(aDir)
aDir := DC_Str2Ar(MYDATABASE->directory)
The eXpress train is coming - and it has more cars.
Re: Flexfile memo arrays workaround
Shall I pull out the code I need from _dcasave.prg to link into my clipper app? It will have to be usable in my original app since it is the only thing that will read flexfile memo arrays, unless I'm missing something.
Re: Flexfile memo arrays workaround
Yes, this is fully Clipper compatible code.Shall I pull out the code I need from _dcasave.prg to link into my clipper app?
The eXpress train is coming - and it has more cars.
Re: Flexfile memo arrays workaround
I'm getting a C "math error M6104 floating-point overflow" when L2BIN() in function _dcitem() tries to convert a 10 digit integer (13123020000). I don't see any documentation in the clipper guide on limits on this function. This isn't greater than the largest 32 bit decimal (4294967295), any ideas?
Re: Flexfile memo arrays workaround
Xbase++ also gives a numeric overflow with numbers that are too long.
If you are storing large numerics in arrays, we may need to treat them as a type "F" (floating point).
Try changing the _dcItem() code like so:
If you are storing large numerics in arrays, we may need to treat them as a type "F" (floating point).
Try changing the _dcItem() code like so:
Code: Select all
Was:
CASE cType == "N" // numeric
IF '.'$STR(xItem)
xItem := STR(xItem)
cRetVal := "F"+l2Bin( len( xItem)) + xItem
ELSE
cL2bin := l2bin(xItem)
IF CHR(26)$cL2bin
cRetVal := "W"+DC_l2Dec(xItem)
ELSE
cRetVal := "N"+l2bin(xItem)
ENDIF
ENDIF
Is:
CASE cType == "N" // numeric
IF '.'$STR(xItem) .OR. xItem > 100000000
xItem := STR(xItem)
cRetVal := "F"+l2Bin( len( xItem)) + xItem
ELSE
cL2bin := l2bin(xItem)
IF CHR(26)$cL2bin
cRetVal := "W"+DC_l2Dec(xItem)
ELSE
cRetVal := "N"+l2bin(xItem)
ENDIF
ENDIF
The eXpress train is coming - and it has more cars.