Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-4946

Save and retrieve in SQLiteStorage miss the generated id

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.4.0
    • 1.3.0
    • None
    • None

    Description

      The following test is failing, saving the object twice because after the first insert the id is not part of serialized value.

      it(@"should retrieve only one element when we save an object without id, read all and update it", ^{
                  NSMutableDictionary* user1 = [NSMutableDictionary
                                                dictionaryWithObjectsAndKeys:@"Christos", @"name", nil];
      
                  BOOL success;
      
                  success = [sqliteStorage save:user1 error:nil];
                  [[theValue(success) should] equal:theValue(YES)];
                  
      
                  // reload store
                  //sqliteStorage = [AGSQLiteStorage storeWithConfig:config];
      
                  // read all
                  NSArray *object = [sqliteStorage readAll];
                  [[[object[0] objectForKey:@"name"] should] equal:@"Christos"];
      
                  success = [sqliteStorage save:object[0] error:nil];
      
                  // read all the store and count
                  NSArray* objects = [sqliteStorage readAll];
                  [[objects should] haveCountOf:(NSUInteger)1];
              });
      

      Attachments

        Activity

          People

            corinnekrych_jira Corinne Krych (Inactive)
            corinnekrych_jira Corinne Krych (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: