php-xbase icon indicating copy to clipboard operation
php-xbase copied to clipboard

Support for indexing?

Open btraas opened this issue 10 years ago • 16 comments

Is there currently any support for indexing (CDX files)? Writing to tables works fine, other than it doesn't update its corresponding .cdx file, which is used by our legacy application.

Are there any plans to support this soon?

btraas avatar Dec 14 '15 16:12 btraas

I'm don't know how the CDX files work, so I don't plan to implement it soon. If you want to help implementing that, I would appreciate that. I could try to help after a first release, but currently I don't have enough time to start that.

luads avatar Dec 14 '15 20:12 luads

No problem. I'll let you know if I figure it out

btraas avatar Dec 16 '15 21:12 btraas

I don't think think the author has thought through index creation. My current attempt will be to link https://github.com/jakubkulhan/btree to this structure. Using a btree object of {key:XXXXX, recno:NN} should do the trick. I'd like to wrap this in a handler class to automatically open the data and an array of index files. My first cut will be to support only one index file.

jchimene avatar Nov 19 '16 03:11 jchimene

how did this went?? @jchimene where you able to go through any of this??

I'm having the situation where the index files don't get updated when I write a new record or update one in the DBF and when I open the legacy foxpro app the new records are not shown, until I 'reindex' the DBF

gadget00 avatar Mar 31 '18 01:03 gadget00

+1 @gadget00, we're doing the same. Would be great to do in this library (or even an external command line program). Let me know if you find anything

btraas avatar Mar 31 '18 03:03 btraas

@btraas so far I haven’t found a solution for this. How can we make a “reindex” function for this?? I just saw that there is a “pack()” function that saves the changes and re-counts the rows like the original VFP. There must be a way to trigger the reindex as well

gadget00 avatar Feb 09 '20 23:02 gadget00

@gadget00 poking through the code I didn't see any support for indexing, creating CDX files etc.

We ended up buying the Indexman command-line utility ($30) to reindex DBFs, which uses Microsoft's FoxPro DLLs to reindex. It's windows-only but I bet it works fine with wine.

https://dbfdoctor.com/en/news/IndexMan/

btraas avatar Feb 09 '20 23:02 btraas

@btraas can you give me an example of how to use that utility? I downloaded and installed it, and also read the help options but can't figure out how I'm supposed to use it. Thanks again

gadget00 avatar Feb 12 '20 17:02 gadget00

@gadget00 I use it like this:

C:\Program Files (x86)\IndexMan\IndexMan.exe <dbfFile> <cdxFile> [-nodeleted]

And wrapped in a C# service that can be triggered by our web server.

btraas avatar Feb 21 '20 23:02 btraas

@gadget00 I use it like this:

C:\Program Files (x86)\IndexMan\IndexMan.exe <dbfFile> <cdxFile> [-nodeleted]

And wrapped in a C# service that can be triggered by our web server.

I have tried it here also with IndexMan with the parameters -reindex -nodeleted. If during the execution of IndexMan the FoxPro application runs also, no more entries are displayed within the application. It looks like an empty database.

Only after a new start of the FoxPro appication all rows (also the new ones) are shown :-(

DierteK avatar Dec 22 '20 10:12 DierteK