DBF Direct Connect

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
zat
Posts: 23
Joined: Tue 21 Jun 2011 13:08

DBF Direct Connect

Post by zat » Mon 17 Dec 2018 14:51

For open DBF table, I'm use next code:

Code: Select all

UniConnection1->ProviderName = "DBF";
UniConnection1->SpecificOptions->Values["Direct"] = "true";
UniConnection1->Database = "C:\TEST";
UniTable1->TableName = "test";

UniConnection1->Connect();
Now, file opens, but only fields type: Character.
Numeric fields not showing.

When I'm using DirectMode = false, all fields showing, but it sometimes depends on the computer.
It works on one computer, on the other - no. Maybe it depends on the ODBC driver.

What am I doing wrong?
Upd.
May be very old file format?
Header dbf-file:
Image

As I can see, this file has dBaseIII format(no memo), 0x03h
Format Visual FoxPro (0x30h) opens normal (may be change by hands: 0x03 to 0x30).


UniDac 7.4.11
RS 10.2.3
Win 10 x64

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBF Direct Connect

Post by azyk » Tue 18 Dec 2018 11:25

Please use the contact form at our site: https://www.devart.com/company/contactform.html and send us all the table files. For example, if a table named table_name, then send table_name.* files (table_name.dbf and table_name.* index and memo files).

zat
Posts: 23
Joined: Tue 21 Jun 2011 13:08

Re: DBF Direct Connect

Post by zat » Tue 18 Dec 2018 12:02

OK. Sent

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBF Direct Connect

Post by azyk » Tue 18 Dec 2018 15:28

Thank for the sent sample. We reproduced the issue and are investigating it now. We will inform you about the results.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBF Direct Connect

Post by azyk » Fri 21 Dec 2018 11:27

In the header of the file, it is specified that data is stored in the dBaseIII format. Therefore, when autodetecting the format, the some fields are fetched incorrectly. In fact, the data is stored in VisualFoxPro format. Therefore, to solve the issue, change the file header into VisualFoxPro. Or set the specific connection option 'DBFFormat' to 'dfVisualFoxPro'.

zat
Posts: 23
Joined: Tue 21 Jun 2011 13:08

Re: DBF Direct Connect

Post by zat » Sun 23 Dec 2018 01:32

In VFP 9 SP2, when opened this file and display system info, VFP detect this file as dBaseIII.
VFP code:

Code: Select all

USE "test.dbf"
? SYS(2029)  && show  table type
Display result code:
3 - Previous versions of FoxPro, FoxBASE+, dBASE III PLUS, and dBASE IV with no memo field.
Table opens without any problem:

Code: Select all

BROWSE   && display table
If we change code 0x03 to 0x30 (file header) and open this file in VFP, then table displayed only one field. It's error. VFP does not understand this format. It can be assumed that source file is correct. Perhaps the component does not correctly determine the file type.
Of course, if you explicitly specify the type of file in the component, the file opens and displays the required fields, but this is wrong. This is the same as open a JPG file as a GIF file. But if you open it in another program, it is a JPG.
It seems to me that the component incorrectly determines the file type.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBF Direct Connect

Post by azyk » Fri 28 Dec 2018 11:37

When the specific option 'DBFFormat' = 'dfAuto', UniDAC takes metadata from headers. In the sent file, the header says that data is stored in dBaseIII format. UniDAC fetches data according to dBaseIII specification: https://www.dbase.com/Knowledgebase/INT ... le_fmt.htm . When the specific option 'DBFFormat' = 'dfVisualFoxPro', UniDAC will fetch data using VisualFoxPro format. Although there is another format in the header.

zat
Posts: 23
Joined: Tue 21 Jun 2011 13:08

Re: DBF Direct Connect

Post by zat » Sat 29 Dec 2018 23:05

azyk wrote: Fri 28 Dec 2018 11:37 When the specific option 'DBFFormat' = 'dfAuto', UniDAC takes metadata from headers. In the sent file, the header says that data is stored in dBaseIII format. UniDAC fetches data according to dBaseIII specification: https://www.dbase.com/Knowledgebase/INT ... le_fmt.htm . When the specific option 'DBFFormat' = 'dfVisualFoxPro', UniDAC will fetch data using VisualFoxPro format. Although there is another format in the header.
Yes. But this format for files after 2010 year. And it's new format. Old format from 1990-2010 years have version dBaseIII v.5. Sample of structure .dbf file may can see at this url: http://www.dbf2002.com/dbf-file-format.html
Currently, these files are still actively used by many programs.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: DBF Direct Connect

Post by azyk » Wed 09 Jan 2019 13:27

We replied to your email.

Post Reply