nano-store 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/Rakefile +1 -1
- data/lib/nano_store/finder.rb +12 -6
- data/lib/nano_store/version.rb +1 -1
- data/vendor/Podfile.lock +2 -2
- data/vendor/Pods/Headers/NanoStore/NSFNanoBag.h +8 -2
- data/vendor/Pods/Headers/NanoStore/NSFNanoSearch.h +2 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoStore_Private.h +1 -1
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoStore_Private.h +1 -1
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.h +8 -2
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.m +7 -4
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m +2 -6
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.h +2 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.m +9 -7
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.m +14 -4
- data/vendor/Pods/Pods.bridgesupport +8 -1
- metadata +8 -43
- data/vendor/NanoStore/Classes/Advanced/NSFNanoEngine.h +0 -542
- data/vendor/NanoStore/Classes/Advanced/NSFNanoEngine.m +0 -1781
- data/vendor/NanoStore/Classes/Advanced/NSFNanoResult.h +0 -137
- data/vendor/NanoStore/Classes/Advanced/NSFNanoResult.m +0 -265
- data/vendor/NanoStore/Classes/Private/NSFNanoBag_Private.h +0 -37
- data/vendor/NanoStore/Classes/Private/NSFNanoEngine_Private.h +0 -69
- data/vendor/NanoStore/Classes/Private/NSFNanoExpression_Private.h +0 -35
- data/vendor/NanoStore/Classes/Private/NSFNanoGlobals_Private.h +0 -99
- data/vendor/NanoStore/Classes/Private/NSFNanoObject_Private.h +0 -35
- data/vendor/NanoStore/Classes/Private/NSFNanoPredicate_Private.h +0 -35
- data/vendor/NanoStore/Classes/Private/NSFNanoResult_Private.h +0 -43
- data/vendor/NanoStore/Classes/Private/NSFNanoSearch_Private.h +0 -48
- data/vendor/NanoStore/Classes/Private/NSFNanoStore_Private.h +0 -57
- data/vendor/NanoStore/Classes/Private/NanoStore_Private.h +0 -37
- data/vendor/NanoStore/Classes/Public/NSFNanoBag.h +0 -306
- data/vendor/NanoStore/Classes/Public/NSFNanoBag.m +0 -485
- data/vendor/NanoStore/Classes/Public/NSFNanoExpression.h +0 -125
- data/vendor/NanoStore/Classes/Public/NSFNanoExpression.m +0 -103
- data/vendor/NanoStore/Classes/Public/NSFNanoGlobals.h +0 -323
- data/vendor/NanoStore/Classes/Public/NSFNanoGlobals.m +0 -145
- data/vendor/NanoStore/Classes/Public/NSFNanoObject.h +0 -298
- data/vendor/NanoStore/Classes/Public/NSFNanoObject.m +0 -187
- data/vendor/NanoStore/Classes/Public/NSFNanoObjectProtocol.h +0 -119
- data/vendor/NanoStore/Classes/Public/NSFNanoPredicate.h +0 -123
- data/vendor/NanoStore/Classes/Public/NSFNanoPredicate.m +0 -130
- data/vendor/NanoStore/Classes/Public/NSFNanoSearch.h +0 -381
- data/vendor/NanoStore/Classes/Public/NSFNanoSearch.m +0 -835
- data/vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.h +0 -124
- data/vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.m +0 -79
- data/vendor/NanoStore/Classes/Public/NSFNanoStore.h +0 -475
- data/vendor/NanoStore/Classes/Public/NSFNanoStore.m +0 -1375
- data/vendor/NanoStore/Classes/Public/NanoStore.h +0 -463
- data/vendor/NanoStore/LICENSE +0 -25
- data/vendor/NanoStore/NanoStore.bridgesupport +0 -1215
- data/vendor/NanoStore/README.md +0 -411
@@ -1,137 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
NSFNanoResult.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
|
-
/*! @file NSFNanoResult.h
|
28
|
-
@brief A unit that describes the result of a search.
|
29
|
-
*/
|
30
|
-
|
31
|
-
/** @class NSFNanoResult
|
32
|
-
* A unit that describes the result of a search.
|
33
|
-
*
|
34
|
-
* @note
|
35
|
-
* The NanoResult is the object representation of a SQL result set. From it, you can obtain the number of rows, the column names and their
|
36
|
-
* associated values.
|
37
|
-
*
|
38
|
-
* @par
|
39
|
-
* After obtaining a NanoResult, it's always a good idea to check whether the <i>error</i> property is nil. If so, the result can be assumed to be
|
40
|
-
* correct. Otherwise, <i>error</i> will point to the main cause of failure.
|
41
|
-
*
|
42
|
-
* @details <b>Example:</b>
|
43
|
-
@code
|
44
|
-
// Instantiate a NanoStore and open it
|
45
|
-
NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
|
46
|
-
|
47
|
-
// Add some data to the document store
|
48
|
-
NSDictionary *info = ...;
|
49
|
-
NSFNanoBag *bag = [NSFNanoBag bag];
|
50
|
-
NSFNanoObject *obj1 = [NSFNanoObject nanoObjectWithDictionary:info];
|
51
|
-
NSFNanoObject *obj2 = [NSFNanoObject nanoObjectWithDictionary:info];
|
52
|
-
[nanoStore addObjectsFromArray:[NSArray arrayWithObjects:obj1, obj2, nil] error:nil];
|
53
|
-
|
54
|
-
// Instantiate a search and execute the SQL statement
|
55
|
-
NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
|
56
|
-
NSFNanoResult *result = [search executeSQL:@"SELECT COUNT(*) FROM NSFKEYS"];
|
57
|
-
|
58
|
-
// Obtain the result (given as an NSString)
|
59
|
-
NSString *value = [result firstValue];
|
60
|
-
|
61
|
-
// Close the document store
|
62
|
-
[nanoStore closeWithError:nil];
|
63
|
-
@endcode
|
64
|
-
*/
|
65
|
-
|
66
|
-
#import <Foundation/Foundation.h>
|
67
|
-
|
68
|
-
@class NSFNanoStore;
|
69
|
-
|
70
|
-
@interface NSFNanoResult : NSObject
|
71
|
-
|
72
|
-
/** * Number of rows contained in the result set. */
|
73
|
-
@property (nonatomic, assign, readonly) NSUInteger numberOfRows;
|
74
|
-
/** * A reference to the error encountered while processing the request, otherwise nil if the request was successful. */
|
75
|
-
@property (nonatomic, strong, readonly) NSError *error;
|
76
|
-
|
77
|
-
/** @name Accessors
|
78
|
-
*/
|
79
|
-
|
80
|
-
//@{
|
81
|
-
|
82
|
-
/** * Returns a new array containing the columns.
|
83
|
-
* @returns An array with the columns retrieved from the result set.
|
84
|
-
*/
|
85
|
-
|
86
|
-
- (NSArray *)columns;
|
87
|
-
|
88
|
-
/** * Returns a new array containing the values for a given column.
|
89
|
-
* @param theIndex is the index of the value in the result set.
|
90
|
-
* @param theColumn is the name of the column in the result set.
|
91
|
-
* @returns An array with the values associated with a given column.
|
92
|
-
* @throws NSRangeException is thrown if the index is out of bounds.
|
93
|
-
*/
|
94
|
-
|
95
|
-
- (NSString *)valueAtIndex:(NSUInteger)theIndex forColumn:(NSString *)theColumn;
|
96
|
-
|
97
|
-
/** * Returns a new array containing the values for a given column.
|
98
|
-
* @param theColumn is the name of the column in the result set.
|
99
|
-
* @returns An array with the values associated with a given column.
|
100
|
-
*/
|
101
|
-
|
102
|
-
- (NSArray *)valuesForColumn:(NSString *)theColumn;
|
103
|
-
|
104
|
-
/** * Returns the first value.
|
105
|
-
* @returns The value of the first element from the result set.
|
106
|
-
*/
|
107
|
-
|
108
|
-
- (NSString *)firstValue;
|
109
|
-
|
110
|
-
//@}
|
111
|
-
|
112
|
-
/** @name Exporting the Results to a File
|
113
|
-
*/
|
114
|
-
|
115
|
-
//@{
|
116
|
-
|
117
|
-
/** * Saves the result to a file.
|
118
|
-
* @param thePath is the location where the result will be saved to a file.
|
119
|
-
*/
|
120
|
-
|
121
|
-
- (void)writeToFile:(NSString *)thePath;
|
122
|
-
|
123
|
-
//@}
|
124
|
-
|
125
|
-
/** @name Miscellaneous
|
126
|
-
*/
|
127
|
-
|
128
|
-
//@{
|
129
|
-
|
130
|
-
/** * Returns a string representation of the result.
|
131
|
-
*/
|
132
|
-
|
133
|
-
- (NSString *)description;
|
134
|
-
|
135
|
-
//@}
|
136
|
-
|
137
|
-
@end
|
@@ -1,265 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
NSFNanoResult.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 "NSFNanoResult.h"
|
28
|
-
#import "NanoStore_Private.h"
|
29
|
-
|
30
|
-
@implementation NSFNanoResult
|
31
|
-
{
|
32
|
-
@protected
|
33
|
-
/** \cond */
|
34
|
-
NSDictionary *results;
|
35
|
-
/** \endcond */
|
36
|
-
}
|
37
|
-
|
38
|
-
@synthesize numberOfRows;
|
39
|
-
@synthesize error;
|
40
|
-
|
41
|
-
/** \cond */
|
42
|
-
|
43
|
-
- (id)init
|
44
|
-
{
|
45
|
-
if ((self = [super init])) {
|
46
|
-
[self _reset];
|
47
|
-
}
|
48
|
-
|
49
|
-
return self;
|
50
|
-
}
|
51
|
-
|
52
|
-
- (void)dealloc
|
53
|
-
{
|
54
|
-
[self _reset];
|
55
|
-
}
|
56
|
-
/** \endcond */
|
57
|
-
|
58
|
-
- (NSString *)description
|
59
|
-
{
|
60
|
-
NSUInteger numberOfColumns = [[results allKeys]count];
|
61
|
-
|
62
|
-
NSMutableString *description = [NSMutableString string];
|
63
|
-
[description appendString:@"\n"];
|
64
|
-
[description appendString:[NSString stringWithFormat:@"Result address : 0x%x\n", self]];
|
65
|
-
[description appendString:[NSString stringWithFormat:@"Number of columns : %ld\n", numberOfColumns]];
|
66
|
-
if (nil == error)
|
67
|
-
if ([[self columns]count] > 0)
|
68
|
-
[description appendString:[NSString stringWithFormat:@"Columns : %@\n", [[self columns]componentsJoinedByString:@", "]]];
|
69
|
-
else
|
70
|
-
[description appendString:[NSString stringWithFormat:@"Columns : %@\n", @"()"]];
|
71
|
-
else
|
72
|
-
[description appendString:[NSString stringWithFormat:@"Columns : %@\n", @"<column info not available>"]];
|
73
|
-
[description appendString:[NSString stringWithFormat:@"Number of rows : %ld\n", numberOfRows]];
|
74
|
-
if (nil == error)
|
75
|
-
[description appendString:[NSString stringWithFormat:@"Error : %@\n", @"<no error>"]];
|
76
|
-
else
|
77
|
-
[description appendString:[NSString stringWithFormat:@"Error : %@\n", [error localizedDescription]]];
|
78
|
-
|
79
|
-
// Print up to the first ten rows to help visualize the cursor
|
80
|
-
if (0 != numberOfColumns) {
|
81
|
-
[description appendString:@"Preview of contents:\n "];
|
82
|
-
NSUInteger i;
|
83
|
-
NSArray *columns = [self columns];
|
84
|
-
|
85
|
-
// Print the names of the columns
|
86
|
-
[description appendString:[NSString stringWithFormat:@"%-15@ | ", @"Row # "]];
|
87
|
-
for (i = 0; i < numberOfColumns; i++) {
|
88
|
-
const char *value = [[columns objectAtIndex:i]UTF8String];
|
89
|
-
if (numberOfColumns - 1 > i) {
|
90
|
-
[description appendString:[NSString stringWithFormat:@"%-15s | ", value]];
|
91
|
-
} else {
|
92
|
-
[description appendString:[NSString stringWithFormat:@"%-15s\n ", value]];
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
// Print the underline
|
97
|
-
const char *value = "===============";
|
98
|
-
[description appendString:[NSString stringWithFormat:@"%-15s | ", value]];
|
99
|
-
for (i = 0; i < numberOfColumns; i++) {
|
100
|
-
if (numberOfColumns - 1 > i) {
|
101
|
-
[description appendString:[NSString stringWithFormat:@"%-15s | ", value]];
|
102
|
-
} else {
|
103
|
-
[description appendString:[NSString stringWithFormat:@"%-15s\n ", value]];
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
// Print the preview of the contents
|
108
|
-
if (numberOfRows > 0) {
|
109
|
-
NSInteger numberOfRowsToPrint = numberOfRows;
|
110
|
-
NSUInteger j;
|
111
|
-
|
112
|
-
if (numberOfRows > 100) {
|
113
|
-
numberOfRowsToPrint = 100;
|
114
|
-
}
|
115
|
-
|
116
|
-
for (i = 0; i < numberOfRowsToPrint; i++) {
|
117
|
-
[description appendString:[NSString stringWithFormat:@"%-15ld | ", i]];
|
118
|
-
for (j = 0; j < numberOfColumns; j++) {
|
119
|
-
NSString *columnName = [columns objectAtIndex:j];
|
120
|
-
const char *value = "<plist data> ";
|
121
|
-
if (NO == [columnName hasSuffix:@"NSFPlist"]) {
|
122
|
-
value = [[self valueAtIndex:i forColumn:columnName]UTF8String];
|
123
|
-
}
|
124
|
-
|
125
|
-
if (numberOfColumns - 1 > j) {
|
126
|
-
[description appendString:[NSString stringWithFormat:@"%-15s | ", value]];
|
127
|
-
} else {
|
128
|
-
[description appendString:[NSString stringWithFormat:@"%-15s", value]];
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
[description appendString:@"\n "];
|
133
|
-
}
|
134
|
-
} else {
|
135
|
-
[description appendString:@"<no data available>"];
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
return description;
|
140
|
-
}
|
141
|
-
|
142
|
-
#pragma mark -
|
143
|
-
|
144
|
-
- (NSArray *)columns
|
145
|
-
{
|
146
|
-
return [results allKeys];
|
147
|
-
}
|
148
|
-
|
149
|
-
- (NSString *)valueAtIndex:(NSUInteger)index forColumn:(NSString *)column
|
150
|
-
{
|
151
|
-
return [[results objectForKey:column]objectAtIndex:index];
|
152
|
-
}
|
153
|
-
|
154
|
-
- (NSArray *)valuesForColumn:(NSString *)column
|
155
|
-
{
|
156
|
-
NSArray *values = [results objectForKey:column];
|
157
|
-
|
158
|
-
if (nil == values)
|
159
|
-
values = [NSArray array];
|
160
|
-
|
161
|
-
return values;
|
162
|
-
}
|
163
|
-
|
164
|
-
- (NSString *)firstValue
|
165
|
-
{
|
166
|
-
NSArray *columns = [results allKeys];
|
167
|
-
if (([columns count] > 0) && (numberOfRows > 0)) {
|
168
|
-
return [[results objectForKey:[columns objectAtIndex:0]]objectAtIndex:0];
|
169
|
-
}
|
170
|
-
|
171
|
-
return nil;
|
172
|
-
}
|
173
|
-
|
174
|
-
- (NSError *)error
|
175
|
-
{
|
176
|
-
return [error copy];
|
177
|
-
}
|
178
|
-
|
179
|
-
- (void)writeToFile:(NSString *)path;
|
180
|
-
{
|
181
|
-
[results writeToFile:[path stringByExpandingTildeInPath] atomically:YES];
|
182
|
-
}
|
183
|
-
|
184
|
-
#pragma mark - Private Methods
|
185
|
-
#pragma mark -
|
186
|
-
|
187
|
-
/** \cond */
|
188
|
-
+ (NSFNanoResult *)_resultWithDictionary:(NSDictionary *)theResults
|
189
|
-
{
|
190
|
-
return [[self alloc]_initWithDictionary:theResults];
|
191
|
-
}
|
192
|
-
|
193
|
-
+ (NSFNanoResult *)_resultWithError:(NSError *)theError
|
194
|
-
{
|
195
|
-
return [[self alloc]_initWithError:theError];
|
196
|
-
}
|
197
|
-
|
198
|
-
- (id)_initWithDictionary:(NSDictionary *)theResults
|
199
|
-
{
|
200
|
-
if (nil == theResults)
|
201
|
-
[[NSException exceptionWithName:NSFUnexpectedParameterException
|
202
|
-
reason:[NSString stringWithFormat:@"*** -[%@ %s]: theResults is nil.", [self class], _cmd]
|
203
|
-
userInfo:nil]raise];
|
204
|
-
|
205
|
-
if ([theResults respondsToSelector:@selector(objectForKey:)] == NO)
|
206
|
-
[[NSException exceptionWithName:NSFUnexpectedParameterException
|
207
|
-
reason:[NSString stringWithFormat:@"*** -[%@ %s]: theResults is not of type NSDictionary.", [self class], _cmd]
|
208
|
-
userInfo:nil]raise];
|
209
|
-
|
210
|
-
if ((self = [self init])) {
|
211
|
-
results = theResults;
|
212
|
-
[self _calculateNumberOfRows];
|
213
|
-
}
|
214
|
-
|
215
|
-
return self;
|
216
|
-
}
|
217
|
-
|
218
|
-
- (id)_initWithError:(NSError *)theError
|
219
|
-
{
|
220
|
-
if (nil == theError)
|
221
|
-
[[NSException exceptionWithName:NSFUnexpectedParameterException
|
222
|
-
reason:[NSString stringWithFormat:@"*** -[%@ %s]: theError is nil.", [self class], _cmd]
|
223
|
-
userInfo:nil]raise];
|
224
|
-
|
225
|
-
if ([theError respondsToSelector:@selector(localizedDescription)] == NO)
|
226
|
-
[[NSException exceptionWithName:NSFUnexpectedParameterException
|
227
|
-
reason:[NSString stringWithFormat:@"*** -[%@ %s]: theError is not of type NSError.", [self class], _cmd]
|
228
|
-
userInfo:nil]raise];
|
229
|
-
|
230
|
-
if ((self = [self init])) {
|
231
|
-
error = theError;
|
232
|
-
[self _calculateNumberOfRows];
|
233
|
-
}
|
234
|
-
|
235
|
-
return self;
|
236
|
-
}
|
237
|
-
|
238
|
-
- (void)_setError:(NSError *)theError
|
239
|
-
{
|
240
|
-
if (error != theError) {
|
241
|
-
error = theError;
|
242
|
-
}
|
243
|
-
}
|
244
|
-
|
245
|
-
- (void)_reset
|
246
|
-
{
|
247
|
-
numberOfRows = -1;
|
248
|
-
results = nil;
|
249
|
-
error = nil;
|
250
|
-
}
|
251
|
-
|
252
|
-
- (void)_calculateNumberOfRows
|
253
|
-
{
|
254
|
-
// We cache the value once, for performance reasons
|
255
|
-
if (-1 == numberOfRows) {
|
256
|
-
NSArray *allKeys = [results allKeys];
|
257
|
-
if ([allKeys count] == 0)
|
258
|
-
numberOfRows = 0;
|
259
|
-
else
|
260
|
-
numberOfRows = [[results objectForKey:[allKeys lastObject]]count];
|
261
|
-
}
|
262
|
-
}
|
263
|
-
/** \endcond */
|
264
|
-
|
265
|
-
@end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
NSFNanoBag_Private.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 "NSFNanoBag.h"
|
28
|
-
|
29
|
-
/** \cond */
|
30
|
-
|
31
|
-
@interface NSFNanoBag (Private)
|
32
|
-
- (void)_setStore:(NSFNanoStore *)aStore;
|
33
|
-
- (BOOL)_saveInStore:(NSFNanoStore *)someStore error:(out NSError **)outError;
|
34
|
-
- (void)_inflateObjectsWithKeys:(NSArray *)someKeys;
|
35
|
-
@end
|
36
|
-
|
37
|
-
/** \endcond */
|
@@ -1,69 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* NSFNanoEngine_Private.h
|
3
|
-
* A lightweight Cocoa wrapper for SQLite
|
4
|
-
*
|
5
|
-
* Written by Tito Ciuro (21-Jan-2003)
|
6
|
-
|
7
|
-
Copyright (c) 2004, Tito Ciuro
|
8
|
-
All rights reserved.
|
9
|
-
|
10
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted
|
11
|
-
provided that the following conditions are met:
|
12
|
-
|
13
|
-
• Redistributions of source code must retain the above copyright notice, this list of conditions
|
14
|
-
and the following disclaimer.
|
15
|
-
• Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
16
|
-
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
17
|
-
• Neither the name of Tito Ciuro nor the names of its contributors may be used to endorse or promote
|
18
|
-
products derived from this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
21
|
-
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
22
|
-
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
23
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
24
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
26
|
-
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
27
|
-
SUCH DAMAGE.
|
28
|
-
*/
|
29
|
-
|
30
|
-
#import "NSFNanoEngine.h"
|
31
|
-
#import "NSFNanoGlobals_Private.h"
|
32
|
-
#import "NSFNanoResult.h"
|
33
|
-
|
34
|
-
/** \cond */
|
35
|
-
|
36
|
-
@interface NSFNanoEngine (Private)
|
37
|
-
+ (NSArray *)NSFP_sharedROWIDKeywords;
|
38
|
-
- (NSString *)NSFP_cacheMethodToString;
|
39
|
-
- (NSString*)NSFP_nestedDescriptionWithPrefixedSpace:(NSString *)prefixedSpace;
|
40
|
-
+ (NSDictionary *)_plistToDictionary:(NSString *)aPlist;
|
41
|
-
- (NSFNanoDatatype)NSFP_datatypeForTable:(NSString *)table column:(NSString *)column;
|
42
|
-
+ (void)NSFP_decodeQuantum:(unsigned char *)dest andSource:(const char *)src;
|
43
|
-
- (void)NSFP_setFullColumnNamesEnabled;
|
44
|
-
- (NSArray *)NSFP_flattenAllTables;
|
45
|
-
- (NSInteger)NSFP_prepareSQLite3Statement:(sqlite3_stmt **)aStatement theSQLStatement:(NSString *)aSQLQuery;
|
46
|
-
- (NSFNanoDatatype)NSFP_datatypeForColumn:(NSString *)tableAndColumn;
|
47
|
-
+ (int)NSFP_stripBitsFromExtendedResultCode:(int)extendedResult;
|
48
|
-
|
49
|
-
- (BOOL)NSFP_beginTransactionMode:(NSString *)theSQLStatement;
|
50
|
-
- (BOOL)NSFP_createTable:(NSString *)table withColumns:(NSArray *)tableColumns datatypes:(NSArray *)tableDatatypes isTemporary:(BOOL)isTemporaryFlag;
|
51
|
-
- (BOOL)NSFP_removeColumn:(NSString *)column fromTable:(NSString *)table;
|
52
|
-
- (void)NSFP_rebuildDatatypeCache;
|
53
|
-
- (BOOL)NSFP_insertStringValues:(NSArray *)values forColumns:(NSArray *)columns table:(NSString *)table;
|
54
|
-
|
55
|
-
- (void)NSFP_sqlString:(NSMutableString*)theSQLStatement appendingTags:(NSArray *)tags quoteTags:(BOOL)flag;
|
56
|
-
- (void)NSFP_sqlString:(NSMutableString*)theSQLStatement appendingTags:(NSArray *)columns;
|
57
|
-
- (BOOL)NSFP_sqlString:(NSMutableString*)theSQLStatement forTable:(NSString *)table withColumns:(NSArray *)columns datatypes:(NSArray *)datatypes;
|
58
|
-
|
59
|
-
- (NSInteger)NSFP_ROWIDPresenceLocation:(NSArray *)tableColumns datatypes:(NSArray *)datatypes;
|
60
|
-
- (BOOL)NSFP_isColumnROWIDAlias:(NSString *)column forTable:(NSString *)table;
|
61
|
-
|
62
|
-
- (NSString *)NSFP_prefixWithDotDelimiter:(NSString *)tableAndColumn;
|
63
|
-
- (NSString *)NSFP_suffixWithDotDelimiter:(NSString *)tableAndColumn;
|
64
|
-
|
65
|
-
- (void)NSFP_installCommitCallback;
|
66
|
-
- (void)NSFP_uninstallCommitCallback;
|
67
|
-
@end
|
68
|
-
|
69
|
-
/** \endcond */
|