nano-store 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.gitignore +1 -0
  2. data/.gitmodules +0 -3
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +24 -0
  5. data/README.md +5 -0
  6. data/Rakefile +21 -1
  7. data/lib/nano_store.rb +2 -0
  8. data/lib/nano_store/finder.rb +76 -0
  9. data/lib/nano_store/model.rb +1 -32
  10. data/lib/nano_store/version.rb +1 -1
  11. data/nano-store.gemspec +1 -0
  12. data/spec/finder_spec.rb +67 -0
  13. data/spec/model_spec.rb +0 -30
  14. data/vendor/Podfile.lock +5 -0
  15. data/vendor/Pods/Headers/NanoStore/NSFNanoBag.h +306 -0
  16. data/vendor/Pods/Headers/NanoStore/NSFNanoBag_Private.h +37 -0
  17. data/vendor/Pods/Headers/NanoStore/NSFNanoEngine.h +542 -0
  18. data/vendor/Pods/Headers/NanoStore/NSFNanoEngine_Private.h +69 -0
  19. data/vendor/Pods/Headers/NanoStore/NSFNanoExpression.h +125 -0
  20. data/vendor/Pods/Headers/NanoStore/NSFNanoExpression_Private.h +35 -0
  21. data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals.h +323 -0
  22. data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals_Private.h +99 -0
  23. data/vendor/Pods/Headers/NanoStore/NSFNanoObject.h +298 -0
  24. data/vendor/Pods/Headers/NanoStore/NSFNanoObjectProtocol.h +119 -0
  25. data/vendor/Pods/Headers/NanoStore/NSFNanoObject_Private.h +35 -0
  26. data/vendor/Pods/Headers/NanoStore/NSFNanoPredicate.h +123 -0
  27. data/vendor/Pods/Headers/NanoStore/NSFNanoPredicate_Private.h +35 -0
  28. data/vendor/Pods/Headers/NanoStore/NSFNanoResult.h +137 -0
  29. data/vendor/Pods/Headers/NanoStore/NSFNanoResult_Private.h +43 -0
  30. data/vendor/Pods/Headers/NanoStore/NSFNanoSearch.h +381 -0
  31. data/vendor/Pods/Headers/NanoStore/NSFNanoSearch_Private.h +48 -0
  32. data/vendor/Pods/Headers/NanoStore/NSFNanoSortDescriptor.h +124 -0
  33. data/vendor/Pods/Headers/NanoStore/NSFNanoStore.h +475 -0
  34. data/vendor/Pods/Headers/NanoStore/NSFNanoStore_Private.h +57 -0
  35. data/vendor/Pods/Headers/NanoStore/NanoStore.h +463 -0
  36. data/vendor/Pods/Headers/NanoStore/NanoStore_Private.h +37 -0
  37. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.h +542 -0
  38. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.m +1781 -0
  39. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.h +137 -0
  40. data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.m +265 -0
  41. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoBag_Private.h +37 -0
  42. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoEngine_Private.h +69 -0
  43. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoExpression_Private.h +35 -0
  44. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoGlobals_Private.h +99 -0
  45. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoObject_Private.h +35 -0
  46. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoPredicate_Private.h +35 -0
  47. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoResult_Private.h +43 -0
  48. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoSearch_Private.h +48 -0
  49. data/vendor/Pods/NanoStore/Classes/Private/NSFNanoStore_Private.h +57 -0
  50. data/vendor/Pods/NanoStore/Classes/Private/NanoStore_Private.h +37 -0
  51. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.h +306 -0
  52. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.m +485 -0
  53. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.h +125 -0
  54. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m +103 -0
  55. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.h +323 -0
  56. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.m +145 -0
  57. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.h +298 -0
  58. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.m +187 -0
  59. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObjectProtocol.h +119 -0
  60. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.h +123 -0
  61. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.m +130 -0
  62. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.h +381 -0
  63. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.m +859 -0
  64. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.h +124 -0
  65. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.m +79 -0
  66. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.h +475 -0
  67. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.m +1375 -0
  68. data/vendor/Pods/NanoStore/Classes/Public/NanoStore.h +463 -0
  69. data/vendor/Pods/NanoStore/LICENSE +25 -0
  70. data/vendor/Pods/NanoStore/README.md +411 -0
  71. data/vendor/Pods/Pods-prefix.pch +3 -0
  72. data/vendor/Pods/Pods-resources.sh +15 -0
  73. data/vendor/Pods/Pods.bridgesupport +1215 -0
  74. data/vendor/Pods/Pods.xcconfig +4 -0
  75. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +974 -0
  76. metadata +89 -6
@@ -0,0 +1,125 @@
1
+ /*
2
+ NSFNanoExpression.h
3
+ NanoStore
4
+
5
+ Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted
8
+ provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
11
+ and the following disclaimer.
12
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
13
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
14
+ * Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
15
+ products derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
20
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ SUCH DAMAGE.
25
+ */
26
+
27
+ #import <Foundation/Foundation.h>
28
+
29
+ #import "NSFNanoGlobals.h"
30
+
31
+ @class NSFNanoPredicate;
32
+
33
+ /*! @file NSFNanoExpression.h
34
+ @brief A unit that describes a series of predicates and its operators.
35
+ */
36
+
37
+ /** @class NSFNanoExpression
38
+ * A unit that describes a series of predicates and its operators.
39
+ * @details <b>Example:</b>
40
+ @code
41
+ // Instantiate a NanoStore and open it
42
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
43
+
44
+ // Prepare the expression
45
+ NSFNanoPredicate *attribute = [NSFNanoPredicate predicateWithColumn:NSFAttributeColumn matching:NSFEqualTo value:@"FirstName"];
46
+ NSFNanoPredicate *value = [NSFNanoPredicate predicateWithColumn:NSFValueColumn matching:NSFEqualTo value:@"Joe"];
47
+ NSFNanoExpression *expression = [NSFNanoExpression expressionWithPredicate:attribute];
48
+ [expression addPredicate:value withOperator:NSFAnd];
49
+
50
+ // Setup the search with the document store and a given expression
51
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
52
+ [search setExpressions:[NSArray arrayWithObject:expression]];
53
+
54
+ // Obtain the matching objects
55
+ NSDictionary *searchResults = [search searchObjectsWithReturnType:NSFReturnObjects error:nil];
56
+
57
+ // Close the document store
58
+ [nanoStore closeWithError:nil];
59
+ @endcode
60
+ */
61
+
62
+ @interface NSFNanoExpression : NSObject
63
+
64
+ /** * Array of NSFNanoPredicate */
65
+ @property (nonatomic, readonly) NSArray *predicates;
66
+ /** * Array of NSNumber wrapping \link NSFGlobals::NSFOperator NSFOperator \endlink */
67
+ @property (nonatomic, readonly) NSArray *operators;
68
+
69
+ /** @name Creating and Initializing Expressions
70
+ */
71
+
72
+ //@{
73
+
74
+ /** * Creates and returns an expression with a given predicate.
75
+ * @param thePredicate the predicate used to initialize the expression. Must not be nil.
76
+ * @return An expression upon success, nil otherwise.
77
+ * @warning The parameter thePredicate must not be nil.
78
+ * @throws NSFUnexpectedParameterException is thrown if the predicate is nil.
79
+ * @see \link initWithPredicate: - (id)initWithPredicate:(NSFNanoPredicate *)aPredicate \endlink
80
+ */
81
+
82
+ + (NSFNanoExpression*)expressionWithPredicate:(NSFNanoPredicate *)thePredicate;
83
+
84
+ /** * Initializes a newly allocated expression with a given expression.
85
+ * @param thePredicate the predicate used to initialize the expression. Must not be nil.
86
+ * @return An expression upon success, nil otherwise.
87
+ * @warning The parameter thePredicate must not be nil.
88
+ * @throws NSFUnexpectedParameterException is thrown if the predicate is nil.
89
+ * @see \link expressionWithPredicate: + (NSFNanoExpression*)expressionWithPredicate:(NSFNanoPredicate *)thePredicate \endlink
90
+ */
91
+
92
+ - (id)initWithPredicate:(NSFNanoPredicate *)thePredicate;
93
+
94
+ //@}
95
+
96
+ /** @name Adding a Predicate
97
+ */
98
+
99
+ //@{
100
+
101
+ /** * Adds a predicate to the expression.
102
+ * @param thePredicate is added to the expression.
103
+ * @param theOperator specifies the operation (AND/OR) to be applied.
104
+ * @warning The parameter thePredicate must not be nil.
105
+ * @throws NSFUnexpectedParameterException is thrown if the predicate is nil.
106
+ */
107
+
108
+ - (void)addPredicate:(NSFNanoPredicate *)thePredicate withOperator:(NSFOperator)theOperator;
109
+
110
+ //@}
111
+
112
+ /** @name Miscellaneous
113
+ */
114
+
115
+ //@{
116
+
117
+ /** * Returns a string representation of the expression.
118
+ * @note Check properties predicates and operators to find out the current state of the expression.
119
+ */
120
+
121
+ - (NSString *)description;
122
+
123
+ //@}
124
+
125
+ @end
@@ -0,0 +1,103 @@
1
+ /*
2
+ NSFNanoExpression.m
3
+ NanoStore
4
+
5
+ Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted
8
+ provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
11
+ and the following disclaimer.
12
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
13
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
14
+ * Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
15
+ products derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
20
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ SUCH DAMAGE.
25
+ */
26
+
27
+ #import "NSFNanoExpression.h"
28
+ #import "NanoStore_Private.h"
29
+
30
+ @implementation NSFNanoExpression
31
+ {
32
+ /** \cond */
33
+ NSMutableArray *predicates;
34
+ NSMutableArray *operators;
35
+ /** \endcond */
36
+ }
37
+
38
+ @synthesize predicates, operators;
39
+
40
+ + (NSFNanoExpression*)expressionWithPredicate:(NSFNanoPredicate *)aPredicate
41
+ {
42
+ if (nil == aPredicate)
43
+ [[NSException exceptionWithName:NSFUnexpectedParameterException
44
+ reason:[NSString stringWithFormat:@"*** -[%@ %s]: the predicate is nil.", [self class], _cmd]
45
+ userInfo:nil]raise];
46
+
47
+ return [[self alloc]initWithPredicate:aPredicate];
48
+ }
49
+
50
+ - (id)initWithPredicate:(NSFNanoPredicate *)aPredicate
51
+ {
52
+ if (nil == aPredicate)
53
+ [[NSException exceptionWithName:NSFUnexpectedParameterException
54
+ reason:[NSString stringWithFormat:@"*** -[%@ %s]: the predicate is nil.", [self class], _cmd]
55
+ userInfo:nil]raise];
56
+
57
+ if ((self = [super init])) {
58
+ predicates = [NSMutableArray new];
59
+ [predicates addObject:aPredicate];
60
+ operators = [NSMutableArray new];
61
+ [operators addObject:[NSNumber numberWithInt:NSFAnd]];
62
+ }
63
+
64
+ return self;
65
+ }
66
+
67
+ /** \cond */
68
+
69
+
70
+ /** \endcond */
71
+
72
+ #pragma mark -
73
+
74
+ - (void)addPredicate:(NSFNanoPredicate *)aPredicate withOperator:(NSFOperator)someOperator
75
+ {
76
+ if (nil == aPredicate)
77
+ [[NSException exceptionWithName:NSFUnexpectedParameterException
78
+ reason:[NSString stringWithFormat:@"*** -[%@ %s]: the predicate is nil.", [self class], _cmd]
79
+ userInfo:nil]raise];
80
+
81
+ [predicates addObject:aPredicate];
82
+ [operators addObject:[NSNumber numberWithInt:someOperator]];
83
+ }
84
+
85
+ - (NSString *)description
86
+ {
87
+ NSUInteger i, count = [predicates count];
88
+ NSMutableArray *values = [NSMutableArray new];
89
+
90
+ // We always have one predicate, so make sure add it
91
+ [values addObject:[[predicates objectAtIndex:0]description]];
92
+
93
+ for (i = 1; i < count; i++) {
94
+ NSString *compound = [[NSString alloc]initWithFormat:@" %@ %@", ([[operators objectAtIndex:i]intValue] == NSFAnd) ? @"AND" : @"OR", [[predicates objectAtIndex:i]description]];
95
+ [values addObject:compound];
96
+ }
97
+
98
+ NSString *value = [values componentsJoinedByString:@""];
99
+
100
+ return value;
101
+ }
102
+
103
+ @end
@@ -0,0 +1,323 @@
1
+ /*
2
+ NSFNanoGlobals.h
3
+ NanoStore
4
+
5
+ Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted
8
+ provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
11
+ and the following disclaimer.
12
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
13
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
14
+ * Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
15
+ products derived from this software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
18
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
20
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ SUCH DAMAGE.
25
+ */
26
+
27
+ #import <Foundation/Foundation.h>
28
+
29
+ /*! @file NSFNanoGlobals.h
30
+ @brief Public available constants to be used in NanoStore.
31
+ */
32
+
33
+ /** * If turned on, NanoStore will log debugging information to Console. */
34
+ extern void NSFSetIsDebugOn (BOOL flag);
35
+
36
+ /** * Determine whether NanoStore debugging services are turned on. */
37
+ extern BOOL NSFIsDebugOn (void);
38
+
39
+ /** * The mode used by NSFNanoEngine to manipulate data in the document store.
40
+ * If FastMode is activated, the document store is opened with all performance turned on (more risky in case of failure). Deactivating it makes it slower,
41
+ * but safer.
42
+ *
43
+ * When FastMode is activated NanoStore continues without pausing as soon as it has handed data off to the operating system.
44
+ * If the application running NanoStore crashes, the data will be safe, but the database might become corrupted if the operating system crashes
45
+ * or the computer loses power before that data has been written to the disk surface.
46
+ * On the other hand, some operations are as much as 50 or more times faster with FastMode activated.
47
+ *
48
+ * If FastMode is deactivated, NanoStore will pause at critical moments to make sure that data has actually been written to the disk surface
49
+ * before continuing. This ensures that if the operating system crashes or if there is a power failure, the database will be uncorrupted after rebooting.
50
+ * Deactivating FastMode is very safe, but it is also slower.
51
+ */
52
+ typedef enum {
53
+ /** * The default mode is slower but safer. */
54
+ NSFEngineProcessingDefaultMode = 1,
55
+ /** * The fast mode is very quick but unsafe. */
56
+ NSFEngineProcessingFastMode
57
+ } NSFEngineProcessingMode;
58
+
59
+ /** * Datatypes used by NanoStore.
60
+ @note Additional information can be found on the SQLite website: http://www.sqlite.org/datatype3.html
61
+ */
62
+ typedef enum {
63
+ /** * Used when NanoStore doesn't know the datatype it has read back from the document store. Its string value equivalent is <b>UNKNOWN</b>.*/
64
+ NSFNanoTypeUnknown = -1,
65
+ /** * Used to define the <i>RowID</i> column type in SQLite tables. Only used if you create your own table via NSFNanoEngine. Its string equivalent is <b>INTEGER</b>. */
66
+ NSFNanoTypeRowUID,
67
+ /** * Used to store NSData elements. Its string equivalent is <b>BLOB</b>. */
68
+ NSFNanoTypeData,
69
+ /** * Used to store NSString elements. Its string equivalent is <b>BLOB</b>. */
70
+ NSFNanoTypeString,
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
+ NSFNanoTypeDate,
73
+ /** * Used to store NSNumber elements. Its string equivalent is <b>REAL</b>. */
74
+ NSFNanoTypeNumber
75
+ } NSFNanoDatatype;
76
+
77
+ /** * Returns the name of a NSFNanoDatatype datatype as a string. */
78
+ extern NSString * NSFStringFromNanoDataType (NSFNanoDatatype aNanoDatatype);
79
+
80
+ /** * Obtains a NSFNanoDatatype datatype by name. */
81
+ extern NSFNanoDatatype NSFNanoDatatypeFromString (NSString *aNanoDatatype);
82
+
83
+ /** * Types of backing store supported by NanoStore.
84
+ * These values represent the storage options available when generating a NanoStore.
85
+ @see NSFNanoStore
86
+ */
87
+ typedef enum {
88
+ /** * Create the transient backing store in RAM. Its contents are lost when the process exits. Fastest, uses more RAM. */
89
+ NSFMemoryStoreType = 1,
90
+ /** * Create a transient temporary backing store on disk. Its contents are lost when the process exits. Slower, uses less RAM than NSFMemoryStoreType. */
91
+ NSFTemporaryStoreType,
92
+ /** * Create a persistant backing store on disk. Its contents are lost when the process exits. Slower, uses less RAM than NSFMemoryStoreType. */
93
+ NSFPersistentStoreType
94
+ } NSFNanoStoreType;
95
+
96
+ /** * Aggregate functions.
97
+ * These functions represent the options available to obtain aggregate results quickly and efficiently.
98
+ * @note Instead of sum(), total() is invoked instead because sum() will throw an "integer overflow" exception
99
+ * if all inputs are integers or NULL and an integer overflow occurs at any point during the computation. On
100
+ * the other hand, total() never throws an integer overflow.
101
+ @see \link NSFNanoSearch::aggregateOperation:onAttribute: -(NSNumber *)aggregateOperation:(NSFAggregateFunctionType)theFunctionType onAttribute:(NSString *)theAttribute \endlink
102
+ */
103
+
104
+ typedef enum {
105
+ /** * It invokes the avg() function. */
106
+ NSFAverage = 1,
107
+ /** * It invokes the count() function. */
108
+ NSFCount,
109
+ /** * It invokes the max() function. */
110
+ NSFMax,
111
+ /** * It invokes the min() function. */
112
+ NSFMin,
113
+ /** * It invokes the total() function. See note above for additional information. */
114
+ NSFTotal
115
+ } NSFAggregateFunctionType;
116
+
117
+ /** * Comparison options.
118
+ * These values represent the options available to some of the classes’ search and comparison methods.
119
+ @see NSFNanoPredicate, NSFNanoSearch
120
+ */
121
+ typedef enum {
122
+ /** * Equal to (case sensitive) */
123
+ NSFEqualTo = 0,
124
+ /** * Begins with (case sensitive) */
125
+ NSFBeginsWith,
126
+ /** * Contains (case sensitive) */
127
+ NSFContains,
128
+ /** * Ends with (case sensitive) */
129
+ NSFEndsWith,
130
+
131
+ /** * Equal to (case insensitive) */
132
+ NSFInsensitiveEqualTo,
133
+ /** * Begins with (case insensitive) */
134
+ NSFInsensitiveBeginsWith,
135
+ /** * Contains (case insensitive) */
136
+ NSFInsensitiveContains,
137
+ /** * Ends with (case insensitive) */
138
+ NSFInsensitiveEndsWith,
139
+
140
+ /** * Greater Ththanan */
141
+ NSFGreaterThan,
142
+ /** * Less than */
143
+ NSFLessThan
144
+ } NSFMatchType;
145
+
146
+ /** * Column types for the Attributes table.
147
+ * These values represent the columns available used for searching.
148
+ @see NSFNanoPredicate
149
+ */
150
+ typedef enum {
151
+ /** * The key column. */
152
+ NSFKeyColumn = 1,
153
+ /** * The attribute column. */
154
+ NSFAttributeColumn,
155
+ /** * The value column. */
156
+ NSFValueColumn
157
+ } NSFTableColumnType;
158
+
159
+ /** * Comparison criteria operators.
160
+ * These values represent the operations available for concatenating predicates in an expression.
161
+ @see NSFNanoExpression, NSFNanoPredicate
162
+ */
163
+ typedef enum {
164
+ /** * And */
165
+ NSFAnd = 1,
166
+ /** * Or */
167
+ NSFOr,
168
+ } NSFOperator;
169
+
170
+ /** * Date comparison options.
171
+ * These values represent the options available when searching and comparing dates.
172
+ @see NSFNanoSearch, NSFNanoPredicate
173
+ */
174
+ typedef enum {
175
+ /** * Before the specified date */
176
+ NSFBeforeDate = 1,
177
+ /** * On the exact date */
178
+ NSFOnDate,
179
+ /** * After the specified date */
180
+ NSFAfterDate
181
+ } NSFDateMatchType;
182
+
183
+ /** * Obtaining search results options.
184
+ * These values represent the options used by the search mechanism to return results.
185
+ @see NSFNanoSearch
186
+ */
187
+ typedef enum {
188
+ /** * Returns the objects. */
189
+ NSFReturnObjects = 1,
190
+ /** * Returns the keys */
191
+ NSFReturnKeys,
192
+ } NSFReturnType;
193
+
194
+ /** * Caching mechanism options.
195
+ * These values represent the options used by the search mechanism to cache results.
196
+ @see NSFNanoEngine
197
+ */
198
+ typedef enum {
199
+ /** * Load data at as soon as it's available. Uses more memory, but data is available quicker. */
200
+ CacheAllData = 1,
201
+ /** * Loads data lazily. First access to data is slow because it retrieves it from disk, but is faster on subsequent requests because the data already exists in memory. */
202
+ CacheDataOnDemand,
203
+ /** * Don't cache data. Slowest mode, uses less memory because it retrieves data from disk every time it's needed. */
204
+ DoNotCacheData,
205
+ } NSFCacheMethod;
206
+
207
+ /** * Text encoding options.
208
+ * The following constants are provided by SQLite as possible string encodings.
209
+ @see NSFNanoEngine
210
+ */
211
+ typedef enum {
212
+ /** * An 8-bit representation of Unicode characters. */
213
+ NSFEncodingUTF8 = 1,
214
+ /** * A 16-bit representation of Unicode characters. */
215
+ NSFEncodingUTF16,
216
+ /** * The encoding representation could not be determined. */
217
+ NSFEncodingUnknown
218
+ } NSFEncodingType;
219
+
220
+ /** * Synchronous options.
221
+ * These values represent the options used to manipulate the synchronous flag. In NSFNanoEngine it's obtained via
222
+ * \link NSFNanoEngine::setSynchronousMode: - (void)setSynchronousMode:(NSFSynchronousMode)theSynchronousMode \endlink
223
+
224
+ @see NSFNanoStore, NSFNanoEngine
225
+ */
226
+ typedef enum {
227
+ /** * SQLite continues without pausing as soon as it has handed data off to the operating system.
228
+ If the application running SQLite crashes, the data will be safe, but the database might become corrupted if
229
+ the operating system crashes or the computer loses power before that data has been written to the disk surface.
230
+ On the other hand, some operations are as much as 50 or more times faster with synchronous OFF. */
231
+ SynchronousModeOff = 0,
232
+ /** * SQLite will still pause at the most critical moments, but less often than in FULL mode.
233
+ There is a very small (though non-zero) chance that a power failure at just the wrong time could corrupt the database
234
+ in NORMAL mode. But in practice, you are more likely to suffer a catastrophic disk failure or some other unrecoverable
235
+ hardware fault. */
236
+ SynchronousModeNormal,
237
+ /** * SQLite will pause at critical moments to make sure that data has actually been written to
238
+ the disk surface before continuing. This ensures that if the operating system crashes or if there is a power failure,
239
+ the database will be uncorrupted after rebooting. FULL synchronous is very safe, but it is also slower. */
240
+ SynchronousModeFull,
241
+ } NSFSynchronousMode;
242
+
243
+ /** * Temporary files location options.
244
+ * These values represent the options used by SQLite to create the temporary files it creates.
245
+ @see NSFNanoEngine
246
+ */
247
+ typedef enum {
248
+ /** * When temp_store is DEFAULT (0), the compile-time C preprocessor macro SQLITE_TEMP_STORE is used to determine
249
+ where temporary tables and indices are stored. */
250
+ TempStoreModeDefault = 0,
251
+ /** * When temp_store is FILE (1) temporary tables and indices are stored in a file. The temp_store_directory pragma
252
+ can be used to specify the directory containing temporary files when FILE is specified. When the temp_store setting is changed,
253
+ all existing temporary tables, indices, triggers, and views are immediately deleted. */
254
+ TempStoreModeFile,
255
+ /** * When temp_store is MEMORY (2) temporary tables and indices are kept in as if they were pure in-memory databases memory. */
256
+ TempStoreModeMemory,
257
+ } NSFTempStoreMode;
258
+
259
+ /** * Journal mode.
260
+ * These values represent the options used by SQLite to the the journal mode for databases associated with the current database connection.
261
+ @note Note that the journal_mode for an in-memory database is either MEMORY or OFF and can not be changed to a different value. An attempt to change
262
+ the journal_mode of an in-memory database to any setting other than MEMORY or OFF is ignored. Note also that the journal_mode cannot be changed
263
+ while a transaction is active.
264
+ @see NSFNanoEngine
265
+ */
266
+ typedef enum {
267
+ /** * The DELETE journaling mode is the normal behavior. In the DELETE mode, the rollback journal is deleted at the conclusion
268
+ of each transaction. Indeed, the delete operation is the action that causes the transaction to commit. (See the document titled
269
+ Atomic Commit In SQLite for additional detail.) */
270
+ JournalModeDelete = 0,
271
+ /** * The TRUNCATE journaling mode commits transactions by truncating the rollback journal to zero-length instead of deleting it.
272
+ On many systems, truncating a file is much faster than deleting the file since the containing directory does not need to be changed. */
273
+ JournalModeTruncate,
274
+ /** * The PERSIST journaling mode prevents the rollback journal from being deleted at the end of each transaction. Instead, the header
275
+ of the journal is overwritten with zeros. This will prevent other database connections from rolling the journal back. The PERSIST
276
+ journaling mode is useful as an optimization on platforms where deleting or truncating a file is much more expensive than overwriting
277
+ the first block of a file with zeros. */
278
+ JournalModePersist,
279
+ /** * The MEMORY journaling mode stores the rollback journal in volatile RAM. This saves disk I/O but at the expense of database safety
280
+ and integrity. If the application using SQLite crashes in the middle of a transaction when the MEMORY journaling mode is set, then
281
+ the database file will very likely go corrupt. */
282
+ JournalModeMemory,
283
+ /** * The WAL journaling mode uses a write-ahead log instead of a rollback journal to implement transactions. The WAL journaling mode is
284
+ persistent; after being set it stays in effect across multiple database connections and after closing and reopening the database. A database
285
+ in WAL journaling mode can only be accessed by SQLite version 3.7.0 or later. */
286
+ JournalModeWAL,
287
+ /** * The OFF journaling mode disables the rollback journal completely. No rollback journal is ever created and hence there is never a
288
+ rollback journal to delete. The OFF journaling mode disables the atomic commit and rollback capabilities of SQLite. The ROLLBACK command
289
+ no longer works; it behaves in an undefined way. Applications must avoid using the ROLLBACK command when the journal mode is OFF.
290
+ If the application crashes in the middle of a transaction when the OFF journaling mode is set, then the database file will very likely go corrupt. */
291
+ JournalModeOFF
292
+ } NSFJournalModeMode;
293
+
294
+ /** * Memory-backed document store descriptor.
295
+ * This value represents the descriptor used by NanoStore to identify memory-backed document stores. In NSFNanoStore is available via
296
+ * \link NSFNanoStore::filePath - (NSString *)filePath \endlink (assuming the document store was
297
+ * created as a memory-backed document store). In NSFNanoEngine, it's available via its <i>path</i> property.
298
+ @see NSFNanoStore, NSFNanoEngine
299
+ */
300
+ extern NSString * const NSFMemoryDatabase;
301
+
302
+ /** * Temporary store descriptor.
303
+ * This value represents the descriptor used by NanoStore to identify temporary document stores. In NSFNanoStore is available via
304
+ * \link NSFNanoStore::filePath - (NSString *)filePath \endlink (assuming the document store was
305
+ * created as a temporary document store). In NSFNanoEngine, it's available via its \link NSFNanoEngine::path - (NSString *)path \endlink property.
306
+ @see NSFNanoStore, NSFNanoEngine
307
+ */
308
+ extern NSString * const NSFTemporaryDatabase;
309
+
310
+ /** * NanoStore's error code. This value is used by NanoStore when reporting errors.
311
+ */
312
+ extern NSInteger const NSFNanoStoreErrorKey;
313
+
314
+ /** * Exception used when an unexpected parameter has been detected. */
315
+ extern NSString * const NSFUnexpectedParameterException;
316
+ /** * Exception used when a non-confirming NSFNanoObjectProtocol object has been detected. */
317
+ extern NSString * const NSFNonConformingNanoObjectProtocolException;
318
+ /** * Exception used when a NSFNanoObjectProtocol object is not behaving properly (i.e its <i>key</i> property does not return a correct value). */
319
+ extern NSString * const NSFNanoObjectBehaviorException;
320
+ /** * Exception used when a problem occurs while manipulating the document store
321
+ * (adding, updating, deleting, opening a transaction, commit, etc.).
322
+ */
323
+ extern NSString * const NSFNanoStoreUnableToManipulateStoreException;