Troubles with DBF

This forum is meant for questions and discussions about the X# language and tools
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Troubles with DBF

Post by Chris »

Hi Gerhard,

That's what I thought at first, too, but this does not seem to be the problem. I removed all code related to locking, updating fields etc and the problem still happens. Here's a very cut down version of the code, which still reproduces this: https://github.com/X-Sharp/XSharpPublic/issues/945
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Troubles with DBF

Post by Horst »

Hi Chris
All this tmp files are created with X# see :CreateKontrollTemp () in func.prg

Another simular problem:
In the attachements now is a additional corrupted file - sina.dbf (in tmp.zip) also created with x# . After lets say 2 or 3 days updating the memofield i have the same problem. i cant modify this file with dbalite - corrupted ftp. this file runs corrpted also under x#2.6a.

I think there is a problem with the rdd, in vo the same runs since 8 years without troubles.

Horst
Attachments
tmp.zip
(202.4 KiB) Downloaded 69 times
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Troubles with DBF

Post by Horst »

Hallo Gerhard

I tryed it, the same result.

Horst
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Troubles with DBF

Post by Horst »

And the Tmp files are only corrupted when i compiling with x# 2.10

Horst
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Troubles with DBF

Post by robert »

Gerhard,

I found a problem. This issue was caused by code in the runtime that is triggered by AppendDB().
When the source and target files have the same structure the RDD system tries to bypass the FieldGet/FieldPut for each of the fields by directly copying the recordbuffer from the source file to the target file.
However, it should not do that when there are Memo fields involved.

I have already committed a fix to the X# Runtime Repo on Github.
When Chris has validated the issue he will most likely send you 2 updated files.
You can also test this yourself if you add a dummy field to the target structure. In that case the structure comparison will detect that copying the recordbuffer is not applicable the fields are read and written one by one.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Troubles with DBF

Post by Horst »

Hallo Robert

1.
Will this also fix my post #21355 ? There i dont use appenddb, only fieldput
my colleg doesnt report loosing data, is it possible that empty FTP files make troubles when i use dbalite for modifying the struc ?

2.
I was copy that 5xx tmp files to new tmp files with a field with 1000chars.
many records cant be copied because of the flexfile reading error.
when i jump over the empty (1024bytes) FTP files no problem.
see the function in the attachements.
also no abenddb ()

Horst

Horst
Attachments
jump.txt
(2.83 KiB) Downloaded 72 times
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Troubles with DBF

Post by robert »

Horst,

This test program is included with the Github ticket that Chris added. I tested this bug with the program.
See https://github.com/X-Sharp/XSharpPublic/issues/945
The issue should be fixed in the new build.
The field size does not play a role here. The problem was with memo fields in the source file and/or target file.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
OhioJoe
Posts: 131
Joined: Wed Nov 22, 2017 12:51 pm
Location: United States

Troubles with DBF

Post by OhioJoe »

Don't know if this helps the discussion but I think it's important to point out there are subtle differences in files created from different apps:
Clipper
FoxBase
DBase IV
FoxPro
Visual FoxPro
X#

and I'm sure there are others. I've used all of these over the years and they all seemed to work in VO. Never ran into any difficulties until X# but our crackerjack development team of Robert and Chris jumped on the problems and fixed things quickly.

Perhaps we need to look at the creation source of the DBFs and compare the behavior of each. As I understand it there's a symbol in the header of a DBF that reveals its format. For example, if the file was created long ago in FoxPro, then it will blow up if the field count extends past 255.

I have no idea how to read or interpret this header but perhaps someone else does.
Joe Curran
Ohio USA
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Troubles with DBF

Post by Chris »

Hi Joe,

The problem Horst reported was indeed a bug in X#, as Robert said earlier and had to do with copying data from dbf to dbf with identical structures. It's already fixed now!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
OhioJoe
Posts: 131
Joined: Wed Nov 22, 2017 12:51 pm
Location: United States

Troubles with DBF

Post by OhioJoe »

Like I said: our crackerjack development team!
Joe Curran
Ohio USA
Post Reply