On 07-Oct-99 David Fedor in his arrogance :) :) wrote:

>>So I just changed it to (&& corrected):
>>
>>    if ((DmGetNextDatabaseByTypeCreator(true, &searchInfo, DatebookDBType,
>>        DatebookAppID, true, &cardNo, &dbID) != 0) ||
>>        ((DatebookDB = DmOpenDatabase(cardNo, dbID, mode | dmModeReadOnly))
>>        == 0))
>>        return false;
> 
> Actually this code still does look for the latest version of the file -
> that's what the "true" parameter means.  Set it to false and you'll get
> even more speed.

Whoa!  I did what you said (set to false) and it really flies now!  But then I
also tried a suggestion by Danny Epstein in which one loop is used to find
all databases:

    MainDB = 0;
    DatebookDB = 0;
    ToDoDB = 0;
    AddressDB = 0;

    while ((DmGetNextDatabaseByTypeCreator(newSearch, &searchInfo, 'DATA',
        NULL, false, &cardNo, &dbID) == 0) &&
        (!DatebookDB || !ToDoDB || !AddressDB || !MainDB)) {
        if (DmDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, &cdate, &mdate,
            NULL, NULL, NULL, NULL, NULL, &creator)) break;
        if (creator == DatebookAppID) {
            dbcdate = cdate;
            dbmdate = mdate;
            DatebookDB = DmOpenDatabase(cardNo, dbID, mode | dmModeReadOnly);
        } else if (creator == ToDoAppID) {
            tdcdate = cdate;
            tdmdate = mdate;
            ToDoDB = DmOpenDatabase(cardNo, dbID, mode | dmModeReadOnly);
        } else if (creator == AddressAppID) {
            AddressDB = DmOpenDatabase(cardNo, dbID, mode | dmModeReadOnly);
        } else if (creator == MainAppID) {
            MainDB = DmOpenDatabase(cardNo, dbID, dmModeReadWrite);
        }
        newSearch = false;
    }

Now it rips through the file opens very quickly.  In fact, now my program
launches just as fast as calculator!  Sweet!


/* Chris Faherty <[EMAIL PROTECTED]>, finger for PGP */

Reply via email to