I need to find the quickest way to replace my DB Access in a large, legacy VFP application. The primary objective is in finding a solid solution to get past the GB limitations of the VFP 9 database engine. The second greatest objective is to do so without a complete rewrite of the legacy access code. I was hoping I could find a hybrid of middle ground that would suffice in the short term. I've played with Cursor Adapters a bit, as well as Advantage OLE DB. I ran into several issues, particularly as these methodologies do not lend themselves to work well with legacy commands (Scatter, Gather, etc.), and I found that I could not reliably mix (trying to replace) the old index expressions with the new style expressions in indexes - and still be able to do a simple open in legacy VFP (I.E. I can't use my quick "BROWSE" command that I have scattered around the project). I've finally realized that, in order to have a near 1-to-1 code replacement, I need to wrap the Ads Client API in home-grown access objects, so as to say replace the legacy "Use Index Alias Shared" statement with an equivalent Open function. So having nearly completed a wrapper, I have a couple of issues bottlenecking my progress. 1. I need to replicate the functionality of the Scatter / Gather commands so as not to have to touch the memory variables in the many Forms throughout the project. 2. I need an optimized method of populating several VFP grids with data that can still be used to update these very large tables on the fly - hopefully optimized for ADS speed and without significant code changes. Are there any suggestions or code bases that have tackled these issues that I may be able to draw upon? |
Add a method to your class to gather field names into a class property named aFldsInfo. aFldsInfo gets loaded with field names right after opening the table successfully with code such as:
Now you can add a new method to your class to scatter data from .dbf/.adt into a memory array ( ::aBuffer ) like this:
And finally a method to gather would simply write back from the ::abuffer array into the corresponding field-names on the table. Of course you can change .abuffer, .aModify, .aFldsInfo for whatever other nomenclature as expected by the rest of your code. |