Flexfile memo arrays workaround

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

Flexfile memo arrays workaround

#1 Post by Tim K »

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

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Flexfile memo arrays workaround

#2 Post by rdonnay »

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.

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.

User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

Re: Flexfile memo arrays workaround

#3 Post by Tim K »

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.

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Flexfile memo arrays workaround

#4 Post by rdonnay »

Shall I pull out the code I need from _dcasave.prg to link into my clipper app?
Yes, this is fully Clipper compatible code.
The eXpress train is coming - and it has more cars.

User avatar
Tim K
Posts: 51
Joined: Thu Jun 03, 2010 3:55 pm

Re: Flexfile memo arrays workaround

#5 Post by Tim K »

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?

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Flexfile memo arrays workaround

#6 Post by rdonnay »

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:

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.

Post Reply