nano-store 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/{CHANGELOG → CHANGELOG.md} +7 -0
  2. data/README.md +5 -1
  3. data/Rakefile +1 -1
  4. data/lib/nano_store.rb +1 -1
  5. data/lib/nano_store/finder.rb +10 -2
  6. data/lib/nano_store/model.rb +7 -7
  7. data/lib/nano_store/version.rb +1 -1
  8. data/spec/association_spec.rb +6 -6
  9. data/spec/finder_spec.rb +2 -0
  10. data/spec/model_spec.rb +33 -3
  11. data/spec/nano_store_spec.rb +5 -0
  12. data/spec/spec_helper.rb +14 -0
  13. data/vendor/Podfile.lock +3 -3
  14. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoBag.h +6 -1
  15. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoEngine.h +5 -0
  16. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoEngine_Private.h +2 -0
  17. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoExpression.h +6 -0
  18. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoExpression_Private.h +1 -1
  19. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoGlobals.h +5 -1
  20. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoGlobals_Private.h +6 -2
  21. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoObject.h +15 -3
  22. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoObject_Private.h +4 -0
  23. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoPredicate.h +6 -1
  24. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoResult.h +5 -0
  25. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoSearch.h +16 -2
  26. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoSortDescriptor.h +7 -1
  27. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoStore.h +12 -0
  28. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoStore_Private.h +3 -1
  29. data/vendor/Pods/BuildHeaders/NanoStore/NSFOrderedDictionary.h +33 -0
  30. data/vendor/Pods/BuildHeaders/NanoStore/NanoStore.h +36 -0
  31. data/vendor/Pods/Headers/NanoStore/NSFNanoBag.h +6 -1
  32. data/vendor/Pods/Headers/NanoStore/NSFNanoEngine.h +5 -0
  33. data/vendor/Pods/Headers/NanoStore/NSFNanoEngine_Private.h +2 -0
  34. data/vendor/Pods/Headers/NanoStore/NSFNanoExpression.h +6 -0
  35. data/vendor/Pods/Headers/NanoStore/NSFNanoExpression_Private.h +1 -1
  36. data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals.h +5 -1
  37. data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals_Private.h +6 -2
  38. data/vendor/Pods/Headers/NanoStore/NSFNanoObject.h +15 -3
  39. data/vendor/Pods/Headers/NanoStore/NSFNanoObject_Private.h +4 -0
  40. data/vendor/Pods/Headers/NanoStore/NSFNanoPredicate.h +6 -1
  41. data/vendor/Pods/Headers/NanoStore/NSFNanoResult.h +5 -0
  42. data/vendor/Pods/Headers/NanoStore/NSFNanoSearch.h +16 -2
  43. data/vendor/Pods/Headers/NanoStore/NSFNanoSortDescriptor.h +7 -1
  44. data/vendor/Pods/Headers/NanoStore/NSFNanoStore.h +12 -0
  45. data/vendor/Pods/Headers/NanoStore/NSFNanoStore_Private.h +3 -1
  46. data/vendor/Pods/Headers/NanoStore/NSFOrderedDictionary.h +33 -0
  47. data/vendor/Pods/Headers/NanoStore/NanoStore.h +36 -0
  48. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.h +5 -0
  49. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.m +142 -131
  50. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.h +5 -0
  51. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.m +148 -51
  52. data/vendor/Pods/NanoStore/Classes/Advanced/NSFOrderedDictionary.h +33 -0
  53. data/vendor/Pods/NanoStore/Classes/Advanced/NSFOrderedDictionary.m +148 -0
  54. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoEngine_Private.h +2 -0
  55. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoExpression_Private.h +1 -1
  56. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoGlobals_Private.h +6 -2
  57. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoObject_Private.h +4 -0
  58. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoStore_Private.h +3 -1
  59. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.h +6 -1
  60. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.m +126 -117
  61. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.h +6 -0
  62. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m +32 -18
  63. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.h +5 -1
  64. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.m +6 -3
  65. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.h +15 -3
  66. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.m +152 -31
  67. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.h +6 -1
  68. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.m +51 -26
  69. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.h +16 -2
  70. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.m +156 -115
  71. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.h +7 -1
  72. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.m +34 -17
  73. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.h +12 -0
  74. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.m +210 -196
  75. data/vendor/Pods/NanoStore/Classes/Public/NanoStore.h +36 -0
  76. data/vendor/Pods/NanoStore/README.md +49 -0
  77. data/vendor/Pods/Pods.bridgesupport +798 -685
  78. metadata +30 -8
@@ -175,7 +175,11 @@
175
175
  /** * The sort holds an array of one or more sort descriptors of type \link NSFNanoSortDescriptor NSFNanoSortDescriptor \endlink. */
176
176
  @property (nonatomic, strong, readwrite) NSArray *sort;
177
177
  /** * The filterClass allows to filter the results based on a specific object class. */
178
- @property (nonatomic, strong, readwrite) NSString *filterClass;
178
+ @property (nonatomic, copy, readwrite) NSString *filterClass;
179
+ /** * If an expression has an offset clause, then the first M rows are omitted from the result set returned by the search operation and the next N rows are returned, where M and N are the values that the offset and limit clauses evaluate to, respectively. Or, if the search would return less than M+N rows if it did not have a limit clause, then the first M rows are skipped and the remaining rows (if any) are returned. */
180
+ @property (nonatomic, assign, readwrite) NSUInteger offset;
181
+ /** * The limit clause is used to place an upper bound on the number of rows returned by a Search operation. */
182
+ @property (nonatomic, assign, readwrite) NSUInteger limit;
179
183
 
180
184
  /** @name Creating and Initializing a Search
181
185
  */
@@ -277,7 +281,7 @@
277
281
  * NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
278
282
  *
279
283
  * // Perform the search
280
- * // The query will be rewritten as @"SELECT NSFKey, NSFPlist, NSFObjectClass FROM NSFKeys"
284
+ * // The query will be rewritten as @"SELECT NSFKey, NSFKeyedArchive, NSFObjectClass FROM NSFKeys"
281
285
  * NSDictionary *results = [search executeSQL:@"SELECT foo, bar FROM NSFKeys" returnType:NSFReturnObjects error:nil];
282
286
  * @endcode
283
287
  * @note The sort descriptor will be ignored when executing custom SQL statements.
@@ -380,4 +384,14 @@
380
384
 
381
385
  //@}
382
386
 
387
+ /** Returns a string representation of the search.
388
+ */
389
+
390
+ - (NSString *)description;
391
+
392
+ /** Returns a JSON representation of the search.
393
+ */
394
+
395
+ - (NSString *)JSONDescription;
396
+
383
397
  @end
@@ -75,7 +75,7 @@
75
75
  @interface NSFNanoSortDescriptor : NSObject
76
76
 
77
77
  /** * The property key to use when performing a comparison */
78
- @property (nonatomic, readonly) NSString *attribute;
78
+ @property (nonatomic, copy, readonly) NSString *attribute;
79
79
  /** * The property to indicate whether the comparison should be performed in ascending mode */
80
80
  @property (nonatomic, readonly) BOOL isAscending;
81
81
 
@@ -119,6 +119,12 @@
119
119
 
120
120
  - (NSString *)description;
121
121
 
122
+ /** Returns a JSON representation of the sort.
123
+ * @note Check properties attribute and isAscending to find out the current state of the sort.
124
+ */
125
+
126
+ - (NSString *)JSONDescription;
127
+
122
128
  //@}
123
129
 
124
130
  @end
@@ -297,6 +297,13 @@
297
297
 
298
298
  - (NSFNanoBag *)bagWithName:(NSString *)theName;
299
299
 
300
+ /** * Retrieves all bags associated with the specified name.
301
+ * @param theName the name of the bag.
302
+ * @returns The bags that match the specified name, an empty array otherwise.
303
+ */
304
+
305
+ - (NSArray *)bagsWithName:(NSString *)theName;
306
+
300
307
  /** * Returns a new array containing the bags found in the document store matching the specified list of keys.
301
308
  * @param theKeys the list of bag keys.
302
309
  * @returns An array with the bags that match the specified list of keys.
@@ -470,6 +477,11 @@
470
477
 
471
478
  - (NSString *)description;
472
479
 
480
+ /** Returns a JSON representation of the store.
481
+ */
482
+
483
+ - (NSString *)JSONDescription;
484
+
473
485
  //@}
474
486
 
475
487
  @end
@@ -25,10 +25,12 @@
25
25
  */
26
26
 
27
27
  #import "NSFNanoStore.h"
28
+ #import "NSFOrderedDictionary.h"
28
29
 
29
30
  /** \cond */
30
31
 
31
32
  @interface NSFNanoStore (Private)
33
+ - (NSFOrderedDictionary *)dictionaryDescription;
32
34
  + (NSFNanoStore *)_createAndOpenDebugDatabase;
33
35
  - (NSFNanoResult *)_executeSQL:(NSString *)theSQLStatement;
34
36
  - (NSString*)_nestedDescriptionWithPrefixedSpace:(NSString *)prefixedSpace;
@@ -37,7 +39,7 @@
37
39
  - (void)_setIsOurTransaction:(BOOL)value;
38
40
  - (BOOL)_isOurTransaction;
39
41
  - (BOOL)_setupCachingSchema;
40
- - (BOOL)_storeDictionary:(NSDictionary *)someInfo forKey:(NSString *)aKey forClassNamed:(NSString *)classType usingSQLite3Statement:(sqlite3_stmt *)storeValuesStatement error:(out NSError **)outError;
42
+ - (BOOL)_storeDictionary:(NSDictionary *)someInfo forKey:(NSString *)aKey forClassNamed:(NSString *)classType error:(out NSError **)outError;
41
43
  - (BOOL)__storeDictionaries:(NSArray *)someObjects forKeys:(NSArray *)someKeys error:(out NSError **)outError;
42
44
  - (BOOL)_bindValue:(id)aValue forAttribute:(NSString *)anAttribute parameterNumber:(NSInteger)aParamNumber usingSQLite3Statement:(sqlite3_stmt *)aStatement;
43
45
  - (BOOL)_checkNanoStoreIsReadyAndReturnError:(out NSError **)outError;
@@ -0,0 +1,33 @@
1
+ //
2
+ // NSFOrderedDictionary.h
3
+ // OrderedDictionary
4
+ //
5
+ // Created by Matt Gallagher on 19/12/08.
6
+ // Copyright 2008 Matt Gallagher. All rights reserved.
7
+ //
8
+ // v2 - ARC-compliant (Tito Ciuro)
9
+ // v1 - Initial release (Matt Gallagher)
10
+ //
11
+ // This software is provided 'as-is', without any express or implied
12
+ // warranty. In no event will the authors be held liable for any damages
13
+ // arising from the use of this software. Permission is granted to anyone to
14
+ // use this software for any purpose, including commercial applications, and to
15
+ // alter it and redistribute it freely, subject to the following restrictions:
16
+ //
17
+ // 1. The origin of this software must not be misrepresented; you must not
18
+ // claim that you wrote the original software. If you use this software
19
+ // in a product, an acknowledgment in the product documentation would be
20
+ // appreciated but is not required.
21
+ // 2. Altered source versions must be plainly marked as such, and must not be
22
+ // misrepresented as being the original software.
23
+ // 3. This notice may not be removed or altered from any source
24
+ // distribution.
25
+ //
26
+
27
+ @interface NSFOrderedDictionary : NSMutableDictionary
28
+
29
+ - (void)insertObject:(id)anObject forKey:(id)aKey atIndex:(NSUInteger)anIndex;
30
+ - (id)keyAtIndex:(NSUInteger)anIndex;
31
+ - (NSEnumerator *)reverseKeyEnumerator;
32
+
33
+ @end
@@ -64,6 +64,13 @@
64
64
  - iOS library runs on the device and simulator
65
65
  - ARC compliant
66
66
 
67
+ @section latest_changes Latest changes
68
+ v2.5 - January 1, 2013
69
+
70
+ Starting with v2.5, the plist mechanism has been replaced with NSKeyedArchiver. There are several reasons for it: it's more compact, faster and uses less memory. Perhaps the most important reason is that it opens the possibility to store other data types.
71
+
72
+ NSNull is now supported. Big thanks to Wanny (https://github.com/mrwanny) for taking the time to improve this section of NanoStore.
73
+
67
74
  @section installation_sec Installation
68
75
 
69
76
  Building NanoStore is very easy. Just follow these steps:
@@ -423,6 +430,35 @@
423
430
  [sortByLastName release];
424
431
  @endcode
425
432
 
433
+ @section paging_limit_sec Paging using Limit and Offset
434
+ SQLite provides a really cool feature called OFFSET that is usually used with a LIMIT clause.
435
+
436
+ The LIMIT clause is used to limit the number of results returned in a SQL statement. So if you have 1000 rows in table, but only want to return the first 10, you would do something like this:
437
+ @code
438
+ SELECT column FROM table LIMIT 10
439
+ @endcode
440
+ Now suppose you wanted to show results 11-20. With the OFFSET keyword it's just as easy. The following query will do:
441
+ @code
442
+ SELECT column FROM table LIMIT 10 OFFSET 10
443
+ @endcode
444
+ Using pagination is also quite easy with NanoStore. This example based on one of the unit tests provided with the NanoStore distro:
445
+ @code
446
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
447
+
448
+ // Assume we have added objects to the store
449
+
450
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
451
+ search.value = @"Barcelona";
452
+ search.match = NSFEqualTo;
453
+ search.limit = 5;
454
+ search.offset = 3;
455
+
456
+ NSDictionary *searchResults = [search searchObjectsWithReturnType:NSFReturnObjects error:nil];
457
+
458
+ // Assuming the query matches some results, NanoStore should have retrieved
459
+ // the first 5 records right after the 3rd one from the result set.
460
+ @endcode
461
+
426
462
  @section performancetips_sec Performance Tips
427
463
 
428
464
  NanoStore by defaults saves every object to disk one by one. To speed up inserts and edited objects, increase NSFNanoStore's \link NSFNanoStore::saveInterval saveInterval \endlink property.
@@ -302,11 +302,16 @@
302
302
 
303
303
  /** * Returns a string representation of the bag.
304
304
  * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
305
- * @see \link dictionaryRepresentation - (NSDictionary *)dictionaryRepresentation \endlink
306
305
  */
307
306
 
308
307
  - (NSString *)description;
309
308
 
309
+ /** Returns a JSON representation of the bag.
310
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
311
+ */
312
+
313
+ - (NSString *)JSONDescription;
314
+
310
315
  //@}
311
316
 
312
317
  @end
@@ -537,6 +537,11 @@
537
537
 
538
538
  - (NSString *)description;
539
539
 
540
+ /** Returns a JSON representation of the engine.
541
+ */
542
+
543
+ - (NSString *)JSONDescription;
544
+
540
545
  //@}
541
546
 
542
547
  @end
@@ -30,10 +30,12 @@
30
30
  #import "NSFNanoEngine.h"
31
31
  #import "NSFNanoGlobals_Private.h"
32
32
  #import "NSFNanoResult.h"
33
+ #import "NSFOrderedDictionary.h"
33
34
 
34
35
  /** \cond */
35
36
 
36
37
  @interface NSFNanoEngine (Private)
38
+ - (NSFOrderedDictionary *)dictionaryDescription;
37
39
  + (NSArray *)NSFP_sharedROWIDKeywords;
38
40
  - (NSString *)NSFP_cacheMethodToString;
39
41
  - (NSString*)NSFP_nestedDescriptionWithPrefixedSpace:(NSString *)prefixedSpace;
@@ -120,6 +120,12 @@
120
120
 
121
121
  - (NSString *)description;
122
122
 
123
+ /** Returns a JSON representation of the expression.
124
+ * @note Check properties predicates and operators to find out the current state of the expression.
125
+ */
126
+
127
+ - (NSString *)JSONDescription;
128
+
123
129
  //@}
124
130
 
125
131
  @end
@@ -29,7 +29,7 @@
29
29
  /** \cond */
30
30
 
31
31
  @interface NSFNanoExpression (Private)
32
- // Just a placeholder.
32
+ - (NSArray *)arrayDescription;
33
33
  @end
34
34
 
35
35
  /** \endcond */
@@ -71,7 +71,11 @@ typedef enum {
71
71
  /** * Used to store NSDate elements in the format <i>yyyy-MM-dd HH:mm:ss:SSS</i>. Its string equivalent is <b>TEXT</b>. */
72
72
  NSFNanoTypeDate,
73
73
  /** * Used to store NSNumber elements. Its string equivalent is <b>REAL</b>. */
74
- NSFNanoTypeNumber
74
+ NSFNanoTypeNumber,
75
+ /** * Used to store NSNull elements. Its string equivalent is <b>NULL</b>. */
76
+ NSFNanoTypeNULL,
77
+ /** * Used to store NSURL elements. Its string equivalent is <b>URL</b>. */
78
+ NSFNanoTypeURL
75
79
  } NSFNanoDatatype;
76
80
 
77
81
  /** * Returns the name of a NSFNanoDatatype datatype as a string. */
@@ -53,6 +53,10 @@
53
53
 
54
54
  */
55
55
 
56
+ extern NSDictionary * safeJSONDictionaryFromDictionary (NSDictionary *dictionary);
57
+ extern NSArray * safeJSONArrayFromArray (NSArray *array);
58
+ extern id safeJSONObjectFromObject (id object);
59
+
56
60
  extern NSString * NSFStringFromMatchType (NSFMatchType aMatchType);
57
61
 
58
62
  extern void _NSFLog (NSString *format, ...);
@@ -67,13 +71,13 @@ extern NSString * const NSFValue;
67
71
  extern NSString * const NSFDatatype;
68
72
  extern NSString * const NSFCalendarDate;
69
73
  extern NSString * const NSFObjectClass;
70
- extern NSString * const NSFPlist;
74
+ extern NSString * const NSFKeyedArchive;
71
75
  extern NSString * const NSFAttribute;
72
76
 
73
77
  #pragma mark -
74
78
 
75
79
  extern NSString * const NSF_Private_NSFKeys_NSFKey;
76
- extern NSString * const NSF_Private_NSFKeys_NSFPlist;
80
+ extern NSString * const NSF_Private_NSFKeys_NSFKeyedArchive;
77
81
  extern NSString * const NSF_Private_NSFValues_NSFKey;
78
82
  extern NSString * const NSF_Private_NSFValues_NSFAttribute;
79
83
  extern NSString * const NSF_Private_NSFValues_NSFValue;
@@ -181,6 +181,8 @@
181
181
 
182
182
  @interface NSFNanoObject : NSObject <NSFNanoObjectProtocol, NSCopying>
183
183
 
184
+ /** * The store where the object is saved. */
185
+ @property (nonatomic, weak, readonly) NSFNanoStore *store;
184
186
  /** * The UUID of the NanoObject. */
185
187
  @property (nonatomic, copy, readonly) NSString *key;
186
188
  /** * The user-supplied information of the NanoObject. */
@@ -304,6 +306,13 @@
304
306
 
305
307
  - (BOOL)isEqualToNanoObject:(NSFNanoObject *)otherNanoObject;
306
308
 
309
+ /** * Saves the uncommitted changes to the document store.
310
+ * @param outError is used if an error occurs. May be NULL.
311
+ * @return YES upon success, NO otherwise.
312
+ */
313
+
314
+ - (BOOL)saveStoreAndReturnError:(out NSError **)outError;
315
+
307
316
  /** * Returns a dictionary that contains the information stored in the object.
308
317
  * @note Check properties info and key to find out the current state of the object.
309
318
  * @see \link description - (NSString *)description \endlink
@@ -311,13 +320,16 @@
311
320
 
312
321
  - (NSDictionary *)dictionaryRepresentation;
313
322
 
314
- /** * Returns a string representation of the bag.
315
- * @note Check properties info and key to find out the current state of the object.
316
- * @see \link dictionaryRepresentation - (NSString *)dictionaryRepresentation \endlink
323
+ /** * Returns a string representation of the nano object.
317
324
  */
318
325
 
319
326
  - (NSString *)description;
320
327
 
328
+ /** Returns a JSON representation of the nano object.
329
+ */
330
+
331
+ - (NSString *)JSONDescription;
332
+
321
333
  //@}
322
334
 
323
335
  @end
@@ -30,6 +30,10 @@
30
30
 
31
31
  @interface NSFNanoObject (Private)
32
32
  - (void)_setOriginalClassString:(NSString *)theClassString;
33
+ + (NSString *)_NSObjectToJSONString:(id)object error:(NSError **)error;
34
+ + (NSDictionary *)_safeDictionaryFromDictionary:(NSDictionary *)dictionary;
35
+ + (NSArray *)_safeArrayFromArray:(NSArray *)array;
36
+ + (id)_safeObjectFromObject:(id)object;
33
37
  @end
34
38
 
35
39
  /** \endcond */
@@ -113,11 +113,16 @@
113
113
 
114
114
  /** * Returns a string representation of the predicate.
115
115
  * @note Check properties column, match and value to find out the current state of the predicate.
116
- * @see \link description - (NSString *)description \endlink
117
116
  */
118
117
 
119
118
  - (NSString *)description;
120
119
 
120
+ /** * Returns a JSON representation of the predicate.
121
+ * @note Check properties column, match and value to find out the current state of the predicate.
122
+ */
123
+
124
+ - (NSString *)JSONDescription;
125
+
121
126
  //@}
122
127
 
123
128
  @end
@@ -132,6 +132,11 @@
132
132
 
133
133
  - (NSString *)description;
134
134
 
135
+ /** Returns a JSON representation of the result.
136
+ */
137
+
138
+ - (NSString *)JSONDescription;
139
+
135
140
  //@}
136
141
 
137
142
  @end
@@ -175,7 +175,11 @@
175
175
  /** * The sort holds an array of one or more sort descriptors of type \link NSFNanoSortDescriptor NSFNanoSortDescriptor \endlink. */
176
176
  @property (nonatomic, strong, readwrite) NSArray *sort;
177
177
  /** * The filterClass allows to filter the results based on a specific object class. */
178
- @property (nonatomic, strong, readwrite) NSString *filterClass;
178
+ @property (nonatomic, copy, readwrite) NSString *filterClass;
179
+ /** * If an expression has an offset clause, then the first M rows are omitted from the result set returned by the search operation and the next N rows are returned, where M and N are the values that the offset and limit clauses evaluate to, respectively. Or, if the search would return less than M+N rows if it did not have a limit clause, then the first M rows are skipped and the remaining rows (if any) are returned. */
180
+ @property (nonatomic, assign, readwrite) NSUInteger offset;
181
+ /** * The limit clause is used to place an upper bound on the number of rows returned by a Search operation. */
182
+ @property (nonatomic, assign, readwrite) NSUInteger limit;
179
183
 
180
184
  /** @name Creating and Initializing a Search
181
185
  */
@@ -277,7 +281,7 @@
277
281
  * NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
278
282
  *
279
283
  * // Perform the search
280
- * // The query will be rewritten as @"SELECT NSFKey, NSFPlist, NSFObjectClass FROM NSFKeys"
284
+ * // The query will be rewritten as @"SELECT NSFKey, NSFKeyedArchive, NSFObjectClass FROM NSFKeys"
281
285
  * NSDictionary *results = [search executeSQL:@"SELECT foo, bar FROM NSFKeys" returnType:NSFReturnObjects error:nil];
282
286
  * @endcode
283
287
  * @note The sort descriptor will be ignored when executing custom SQL statements.
@@ -380,4 +384,14 @@
380
384
 
381
385
  //@}
382
386
 
387
+ /** Returns a string representation of the search.
388
+ */
389
+
390
+ - (NSString *)description;
391
+
392
+ /** Returns a JSON representation of the search.
393
+ */
394
+
395
+ - (NSString *)JSONDescription;
396
+
383
397
  @end
@@ -75,7 +75,7 @@
75
75
  @interface NSFNanoSortDescriptor : NSObject
76
76
 
77
77
  /** * The property key to use when performing a comparison */
78
- @property (nonatomic, readonly) NSString *attribute;
78
+ @property (nonatomic, copy, readonly) NSString *attribute;
79
79
  /** * The property to indicate whether the comparison should be performed in ascending mode */
80
80
  @property (nonatomic, readonly) BOOL isAscending;
81
81
 
@@ -119,6 +119,12 @@
119
119
 
120
120
  - (NSString *)description;
121
121
 
122
+ /** Returns a JSON representation of the sort.
123
+ * @note Check properties attribute and isAscending to find out the current state of the sort.
124
+ */
125
+
126
+ - (NSString *)JSONDescription;
127
+
122
128
  //@}
123
129
 
124
130
  @end
@@ -297,6 +297,13 @@
297
297
 
298
298
  - (NSFNanoBag *)bagWithName:(NSString *)theName;
299
299
 
300
+ /** * Retrieves all bags associated with the specified name.
301
+ * @param theName the name of the bag.
302
+ * @returns The bags that match the specified name, an empty array otherwise.
303
+ */
304
+
305
+ - (NSArray *)bagsWithName:(NSString *)theName;
306
+
300
307
  /** * Returns a new array containing the bags found in the document store matching the specified list of keys.
301
308
  * @param theKeys the list of bag keys.
302
309
  * @returns An array with the bags that match the specified list of keys.
@@ -470,6 +477,11 @@
470
477
 
471
478
  - (NSString *)description;
472
479
 
480
+ /** Returns a JSON representation of the store.
481
+ */
482
+
483
+ - (NSString *)JSONDescription;
484
+
473
485
  //@}
474
486
 
475
487
  @end