GNU's Database Manager, ported to Windows CEWhen the built-in solution doesn't work, we look for other answers. While working on Ink Spot CE, we realized that there are some major shortcomings in Windows CE databases. To point out the worst issues:
- Individual records are limited to 64k. Since strings are Unicode under Windows CE, this makes the maximum single string 32k.
- Windows CE databases must be stored on the internal store. Users that want to store them on their super-duper external storage card are out of luck.
After fighting through two releases, it was obvious that our users wanted something better than what Microsoft provided. We've always liked using GNU utilities whenever possible, so we looked around for an implementation of GDBM (the GNU Database Manager) for Windows CE. We found a port of GDBM for Win32, but it relies heavily on ANSI compatability functions that aren't available for Windows CE. Not discouraged, we started over with the GDBM 1.7.3 source code, and the result is here for all to see.
GDBMce is a port of GDBM 1.7.3 (not a port of the Win32 port of 1.7.3). This code hasn't been fully tested with the GDBM regression suite, but in our basic tests we haven't encountered any serious problems. If you find any significant errors, please submit code fixes back to us at firstname.lastname@example.org. We do not support this code or provide any warrantee, but are providing the code to the general public under the terms of the GNU general public license, version 2.
There are some limitations of GDBMCE related to the Windows CE architecture:
- CE has no concept of file links. Because of this, the .dir and .pag compatability files don't exist.
- CE doesn't support on-the-fly file locking, so only one client can open the database for writing at a time.
- CE has no atomic file actions, so there is a small gap during database reorganization where the database doesn't exist.
- CE only supports files up to 4 megabytes in size on its internal store (no matter what size that store is). Storage cards are not affected by this limitation. Any file writes to the database that would extend it beyond its 4 meg limit don't trip Win32 errors, but are detected in cehack.c and reported as critical write errors. If you write a database implementation with this, do what we do and make the application check the size of the database and its location before trying to write the record.
- We haven't tested any of the compatability dbm or ndbm functions, since we don't see a huge reason for this. Anyone using GDBM for CE is, more than likely, starting over from scratch anyway.