I have some questions for the database guys. My current project uses Access as a back end. I’ve got about 20 tables in a beautifully normalized relational setup with referential integrity enforced and all that good stuff. But the more polished the app gets, the less I actually interact with the database. (As it should be.)
All calls to the database are in a single module, which keeps shrinking. Data demands are unusually low, which is one of the reasons Access is such a good choice. Of the 20 tables, I expect virtually all of them to have, at most, 50 records, with one or two maybe pushing a couple thousand.
Because of this incredibly low amount of data, I’ve been using UDT arrays like a madman. The data screens load the entire table into a UDT array when opened, let you save to the array, then when you close the form it commits any changes from the UDT array back to the table. All data integrity issues are validated before allowing the user to save to the UDT, well before the database gets written to.
At this point I’m considering bailing on the backend altogether, and just using unix-style file operations to dump the UDT arrays directly to and from a file. I figure the easiest way would be to make a “system” UDT whose elements are all the UDT arrays, and dump that system UDT to a file in a single statement. It would certainly result in more compact code (in the data module) and saved files. I’m thinking the saved files would go from 800k to about 50k, tops.
Question #1 is are there any hidden issues that might screw me up attempting this approach? I’d hate to get halfway through setting it up only to run into a brick wall and have to restore old code. I hate doing that.
It’s obviously more of a processing app than a data storage app. The processing used to be done in the data module, with recordsets and whatnot. (SLOOOOWWW.) I’ve since moved all the processing out of the data module and am using UDTs instead, where I just load (basically) all the data into memory and go nuts. (Peppy!) Long ago I transcribed a sorting algorithm, and just recently added the ultra-simple binary searching capability, so it’s a pretty functional data model as is. I just use two-dimensional arrays as indexes on my UDTs, and all I ever really need to do is sort and search. Other than the code looking a touch less readable, I see no real loss in functionality. It’s rather nice having all data available without needing to open any tables.
On the plus side, I could certainly lose a few references and components, reducing the install footprint and making me feel cool in the process. Anybody here ever write their own backend?
Question #2 applies specifically to Access as a backend. I’ve been on a real XP-compliant kick lately, trying to use all the proper folder locations and registry entries as per the Microsoft official guidelines. If I install the app as a shared application, then user rights may become an issue. Currently, an empty copy of the database resides in program files, which gets copied to the user’s application data area on first use. Since limited users can’t create files in the shared application data area, I’d need to copy the empty database there on install. Not a problem. The question is this: Can limited users read Access databases in All Users\Application Data\MyApp? (How does the *.ldb file get created if they don’t have rights to create a file there?)