[MDEV-6889] Allow CONNECT engine to read and write to FoxPro DBF/CDX/FPT files Created: 2014-10-18  Updated: 2017-05-16  Resolved: 2017-01-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Fix Version/s: 10.0.30, 10.1.22, 10.2.5

Type: Task Priority: Major
Reporter: BJ Quinn Assignee: Olivier Bertrand
Resolution: Fixed Votes: 1
Labels: None

Attachments: File M_PROD.CDX     File M_PROD.DBF     File M_PROD.FPT    

 Description   

I tried to create a CONNECT table using the following command –

create table cust engine=CONNECT table_type=DBF file_name='test.dbf';

I got an error –

Error Code: 1105. Unsupported DBF type M

I'm assuming DBF type M means that there are Memo fields in use? Or perhaps that means something else.

Anyway, if it's a reasonable request, support for FoxPro tables including memo field support (FPT files) and CDX indexes would be extremely helpful.



 Comments   
Comment by Carlos Manuel Escalona Villeda [ 2017-01-13 ]

I attached a DBF with memofile to test

Comment by Olivier Bertrand [ 2017-01-16 ]

M is for unicode string (memo), byte string (picture or object) or None. In the dbf file, it is a10 digits (bytes) representing a .DBT block number. The number is stored as a string, right justified and padded with blanks.
This was not supported but it is easy to add it. I did it and the column is displayed as a number.
However, I have no idea of what the FTP and CDX binary files are used for.
This is not a real support but it makes possible to use the table.
NOTE: Apparently, FOXPRO adds some sort of padding to the records. The result is that the default LRECL calculated by CONNECT does not match the LRECL stored in the DBF file header. This is checked by CONNECT that issues an error message. To prevent this, when creating the table, specify the LRECL option or add:

 option_list='accept=YES'

Comment by Carlos Manuel Escalona Villeda [ 2017-01-16 ]

The CDX file is an index, and the FPT file is the storage to memo field data.

Comment by Olivier Bertrand [ 2017-01-18 ]

The M column type is now accepted but just returns the .DBT block number.

Note: it is possibly not included in version 10.1.21 that was announced just the day after I pushed the fix.

Comment by Carlos Manuel Escalona Villeda [ 2017-01-18 ]

great!

Generated at Thu Feb 08 07:15:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.