Append SDF error

Append SDF error

Postby Marc Vanzegbroeck » Thu Nov 04, 2010 7:38 pm

Hello,

I have a program that import some information from a text-file with the append from SDF command.
From time to time it doesn't import all records.
Here is the test-code:
Code: Select all  Expand view
#INCLUDE "fivewin.CH"
REQUEST DBFCDX
FUNCTION test()
   local vstruct:={}
   RDDSETDEFAULT("DBFCDX")
   dbstructuur:={}
   aadd(vstruct,{'LINE','C',199,0})
   dbcreate('import.tmp',vstruct)
   use ('import.tmp') new
   appe from test.txt sdf
   go top
   browse()
RETURN nil
 


Here is the text-file that can't be imported completly. It allways stops at the same record, and I can't find out why.
http://www.vms.be/FWTest/test.txt
Can someone try this?
My last record is allways:
<Artikelcode>SCTATC</Artikelcode>

I use FW710.

Thanks,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Append SDF error

Postby driessen » Fri Nov 05, 2010 12:36 am

Marc,

To my opinion, your TEST.TXT-file is an XML-file.
I don't think you can add data to your DBF-file by using SDF.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Append SDF error

Postby Marc Vanzegbroeck » Fri Nov 05, 2010 8:04 am

Michel,

This file is indead an xml-file. But this is also a text-file. So why can't he import it, and why always on the same line? It's only with this file. Most other xml-files give no problem.
I head this problem also before when importing prg-files. Most of them are imported complete, other not...

I also try it with clipper52 and also with foxpro, and then the file is imported without any problem!!!

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Append SDF error

Postby James Bott » Fri Nov 05, 2010 4:11 pm

Marc,

It is working fine here. I copied the text.txt from within IE. I wonder if there is some special character after the last line you are getting. Take a look at the original file with a hex editor, or zip it and send it to me at jbott at compuserve dot com.

I am using FWH 10.8/xHarbour.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Append SDF error

Postby Marc Vanzegbroeck » Fri Nov 05, 2010 6:48 pm

James,

File send.

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Append SDF error

Postby James Bott » Fri Nov 05, 2010 7:19 pm

For those interested in the solution, I found that if I appended a space to the end of each line in the text.txt file, then APPENDed it, it works fine. I have no idea why this is needed, but it is a viable workaround.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Append SDF error

Postby Enrico Maria Giordano » Sat Nov 06, 2010 10:38 am

Can you make a little sample and try it with Clipper? If it were a real bug I would report it to the developers list.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8711
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Append SDF error

Postby Marc Vanzegbroeck » Sat Nov 06, 2010 11:42 am

Enrico,

Like I already explained in previous message, in clipper52 it work just fine.

Here is the link of the text-file in zip format.
http://www.vms.be/FWTest/test.zip

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Append SDF error

Postby Euclides » Sat Nov 06, 2010 12:16 pm

Marc,
The fields in TEST.TXT are separated by hex "0A".
If they are before treted by an text editor and saved, the separator becomes "0D0A" and then it works right. It could be a xHarbour error.
Only tested with xHarbour Compiler build 1.0.0 (SimpLex)
Regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Re: Append SDF error

Postby Enrico Maria Giordano » Sat Nov 06, 2010 12:28 pm

Marc Vanzegbroeck wrote:Enrico,

Like I already explained in previous message, in clipper52 it work just fine.

Here is the link of the text-file in zip format.
[url]http::/www.vms.be/FWTest/test.zip[/url]

Regards,
Marc


Thank you. I'm looking at the sample...

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8711
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Append SDF error

Postby Enrico Maria Giordano » Sat Nov 06, 2010 12:55 pm

Ok, I reported it to the developers list. I tried to fix the problem but it's really too much complicated for me, sorry.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8711
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Append SDF error

Postby Marc Vanzegbroeck » Sat Nov 06, 2010 3:16 pm

Euclides,

Thanks for the info.

I use now this code as workaround.

Code: Select all  Expand view
#INCLUDE "fivewin.CH"
REQUEST DBFCDX
FUNCTION test()
   local vstruct:={}
   memowrit('test.tmp',strtran(memoread('test.txt'),chr(10),chr(13)+chr(10)))
   RDDSETDEFAULT("DBFCDX")
   dbstructuur:={}
   aadd(vstruct,{'LINE','C',199,0})
   dbcreate('import.tmp',vstruct)
   use ('import.tmp') new

   appe from test.tmp sdf
   go top
   browse()
RETURN nil
 


Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Append SDF error

Postby James Bott » Sat Nov 06, 2010 5:36 pm

Euclides,

The fields in TEST.TXT are separated by hex "0A".
If they are before treted by an text editor and saved, the separator becomes "0D0A" and then it works right. It could be a xHarbour error.


When I look at the file the fields ARE separated by 0D0A already, so I don't think that is the problem.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Append SDF error

Postby Enrico Maria Giordano » Tue Nov 09, 2010 8:25 am

The bug has been fixed by Vicente Guerra in the xHarbour CVS.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8711
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Append SDF error

Postby James Bott » Tue Nov 09, 2010 2:53 pm

Enrico,

Thanks for getting that done.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests