Message 20/1349 From Chris Guffey Oct 10, 06 11:02:58 AM -0400 To: "Bob Lechner" Subject: Re: 91.522 HW3 - prototype suggestion for keyExists Cc:06f522 Thanks Prof. Lechner, I think those last two emails cleared up some things. 1) When I say a 'specific TT', I mean a row in the TT table. I was assuming it was an object of some sort that we'd have direct access to. Now I'm think we only have indirect access to it? 2) You talked previously about using pr_parse, however I do not see an entry for it in the chgen manual. 3) To the rest of the team, I'm providing updated psuedocode here based on the revised prototype suggested by Prof. Lechner and using the chgen manual. If anyone else has any comments or suggestions for changes they'd be more than welcome, suffice to say I am not 100% certain about any of this below: bool keyValueListExists(char* tableType, /* a TTabbrev */ char* CKname, /* a CK name */ char* valueList) /* list of CK-field values */ { // find the TT row, my understanding is that pr_find // has some hiden functionality, in that it populates // a global variable with a pointer to the TT row if found, NULL if not found pr_find(TT, TTabb, tableType); if (TTcurr == NULL) return false; // use pr_parse to separate values from valueList // I couldn't find the documentation on pr_parse in the chgen manual // for the sake of this psuedocode I'll assume it'll break down valueList into a STL vector v = pr_parse(valueList)? // the ck and tt ids need to be encoded before being passed into child_loop int nCKid; int nTTid; encode(ttcurr->ttid, &nTTid); encode(ttcur->ckid, &nCKid); int i(0); // my understanding is that child_loop will find and // populate the global CKcurr variable (much like pr_find) // it will loop through the entire linked list updating CKcurr each time child_loop(TT, CK, nCKid, nTTid) { // compare the values of each ck value // type conversion based on field declarations // is needed before comparing if (v[i] != CKcurr->value) return false i++; } return true; } // end keyValueListExists