aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPArrayAdditions.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-06 17:52:08 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-06 17:52:08 +0000
commit2f5c4b9bab18b54f2d37f4b4a05afa116cfd0c44 (patch)
tree63709f4a8da66c65bbb4682e92d8e0027f7aa344 /Source/SPArrayAdditions.m
parentaaebe1f173659b1d0b3406e6722491d70c6a76e6 (diff)
downloadsequelpro-2f5c4b9bab18b54f2d37f4b4a05afa116cfd0c44.tar.gz
sequelpro-2f5c4b9bab18b54f2d37f4b4a05afa116cfd0c44.tar.bz2
sequelpro-2f5c4b9bab18b54f2d37f4b4a05afa116cfd0c44.zip
• moved macros enumerate() and sizeOf() to sequel-pro_Prefix.pch
• added to SPArrayAdditions.m - (NSArray *)subarrayWithIndexes:(NSIndexSet *)indexes • added "Copy as SQL INSERT" to MainMenu (not yet activated) • added to CMCopyTable - (NSString *)selectedRowsAsSqlInserts for copying selectedRows as INSERT INTO ... string (under constructions, up to now it works for strings)
Diffstat (limited to 'Source/SPArrayAdditions.m')
-rw-r--r--Source/SPArrayAdditions.m17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/SPArrayAdditions.m b/Source/SPArrayAdditions.m
index 66473d81..853421e0 100644
--- a/Source/SPArrayAdditions.m
+++ b/Source/SPArrayAdditions.m
@@ -42,4 +42,21 @@
return result;
}
+- (NSArray *)subarrayWithIndexes:(NSIndexSet *)indexes
+{
+ NSMutableArray *subArray = [NSMutableArray arrayWithCapacity:[indexes count]];
+ unsigned count = [self count];
+
+ unsigned index = [indexes firstIndex];
+ while ( index != NSNotFound )
+ {
+ if ( index < count )
+ [subArray addObject: [self objectAtIndex: index]];
+
+ index = [indexes indexGreaterThanIndex: index];
+ }
+
+ return subArray;
+}
+
@end