home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / next / programm / 7785 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.2 KB  |  68 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!fub!tpki.toppoint.de!jacobsen
  3. From: jacobsen@tpki.toppoint.de (Joerg Jacobsen)
  4. Subject: customized adaptor and 'update'
  5. Organization: Toppoint Mailbox e.V.
  6. Date: Wed, 16 Dec 1992 21:46:52 GMT
  7. Message-ID: <1992Dec16.214652.25134@tpki.toppoint.de>
  8. Lines: 58
  9.  
  10. Hi Guys,
  11.  
  12. don't seem to be able to solve this by myself...
  13.  
  14. I'm currently writing a customized adaptor and have a hard time getting
  15. the 'update' mechanism to work.  This is the scenario:
  16.  
  17. Let's say you have a DBRecordList object set up like in the 'AddressBook'
  18. example. Excerpt from Controller.m:
  19.  
  20.        recordList = [[DBRecordList alloc] init];
  21.     
  22.         /* A unique key is needed if you want to update or insert new
  23.          * data via the record list into the database. If no key is defined,
  24.          * the data retrieved via the  record list is read-only.
  25.          */
  26.     keyList = (List *)[[List alloc] init];
  27.     [keyList addObject:authId];
  28.     [recordList setKeyProperties:keyList];
  29.     [keyList free];
  30.     
  31.     [recordList setProperties:propertyList ofSource:authorEntity];
  32.     [recordList setDelegate:self];
  33.  
  34.     [recordList addRetrieveOrder:DB_AscendingOrder for:lastName];
  35.     [recordList addRetrieveOrder:DB_AscendingOrder for:firstName];                    
  36.     [recordList fetchUsingQualifier:nil];
  37.     
  38. Then you do a bunch of changes to the records of this list and finally
  39. execute
  40.  
  41.     [recordList saveModifications];
  42.     
  43. But instead of just letting the adaptor quitly modify its data source
  44. the recordList's delegate gets bugged with a DBFailureCode
  45.  
  46.     DBRecordKeyNotUnique.
  47.     
  48. (In my DBModel I have set the authId property also to be 'unique key'.
  49.  Needless to say that my table does _not_ have duplicate keys.)
  50.  
  51.  I know that my description of the problem leaves room for a lot of
  52.  speculation but maybe it still resembles some pattern?
  53.  
  54.  Question:
  55.      Should I hold my adaptor responsible for this symptom or could the
  56.      DBModel already screw things up like this (unfortunatly I have neither
  57.      Oracle nor Sybase to check it out)?
  58.  
  59. thanks,
  60.  
  61. Joerg Jacobsen.
  62.  
  63.  
  64. -- 
  65. Jacobsen Softwareentwicklung    jacobsen@tpki.toppoint.de (NeXTmail)
  66. W-2300 Kiel            Voice:    (+49) 431 805467
  67. Germany                Fax:    (+49) 431 553623
  68.