motion-yapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/motion-yapper.rb +1 -0
- data/lib/yapper.rb +3 -5
- data/lib/yapper/config.rb +2 -0
- data/lib/yapper/db.rb +105 -40
- data/lib/yapper/document.rb +7 -4
- data/lib/yapper/document/callbacks.rb +0 -7
- data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
- data/lib/yapper/document/relation.rb +29 -22
- data/lib/yapper/document/selection.rb +122 -54
- data/lib/yapper/extensions.rb +12 -24
- data/lib/yapper/settings.rb +43 -0
- data/lib/yapper/timestamps.rb +2 -0
- data/lib/yapper/version.rb +1 -1
- data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
- data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
- data/spec/integration/db_spec.rb +70 -0
- data/spec/integration/defaults_spec.rb +37 -0
- data/spec/integration/extensions_spec.rb +14 -0
- data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
- data/spec/integration/relation_spec.rb +4 -4
- data/vendor/Podfile.lock +9 -11
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
- data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
- data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
- data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
- data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
- data/vendor/Pods/Headers/____Pods-environment.h +15 -15
- data/vendor/Pods/Manifest.lock +9 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
- data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
- data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
- data/vendor/Pods/Pods-environment.h +15 -15
- data/vendor/Pods/Pods.xcconfig +3 -3
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- data/vendor/Pods/YapDatabase/README.md +3 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
- data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
- metadata +80 -108
- data/Gemfile.lock +0 -63
- data/lib/yapper/attachment.rb +0 -48
- data/lib/yapper/document/attachment.rb +0 -26
- data/lib/yapper/sync.rb +0 -134
- data/lib/yapper/sync/data.rb +0 -12
- data/lib/yapper/sync/event.rb +0 -194
- data/lib/yapper/sync/queue.rb +0 -164
- data/spec/integration/all_spec.rb +0 -40
- data/spec/integration/sync_spec.rb +0 -42
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
- data/vendor/Pods/AFNetworking/LICENSE +0 -19
- data/vendor/Pods/AFNetworking/README.md +0 -208
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
- data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
- data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
- data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
- data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
- data/vendor/Pods/Reachability/LICENCE.txt +0 -24
- data/vendor/Pods/Reachability/README.md +0 -65
- data/vendor/Pods/Reachability/Reachability.h +0 -109
- data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -0,0 +1,99 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
|
4
|
+
/**
|
5
|
+
* The grouping block handles both filtering and grouping.
|
6
|
+
*
|
7
|
+
* When you add or update rows in the databse the grouping block is invoked.
|
8
|
+
* Your grouping block can inspect the row and determine if it should be a part of the view.
|
9
|
+
* If not, your grouping block simply returns 'nil' and the object is excluded from the view (removing it if needed).
|
10
|
+
* Otherwise your grouping block returns a group, which can be any string you want.
|
11
|
+
* Once the view knows what group the row belongs to,
|
12
|
+
* it will then determine the position of the row within the group (using the sorting block).
|
13
|
+
*
|
14
|
+
* You should choose a block type that takes the minimum number of required parameters.
|
15
|
+
* The view can make various optimizations based on required parameters of the block.
|
16
|
+
**/
|
17
|
+
typedef id YapDatabaseViewGroupingBlock; // One of the YapDatabaseViewGroupingX types below.
|
18
|
+
|
19
|
+
typedef NSString* (^YapDatabaseViewGroupingWithKeyBlock)(NSString *collection, NSString *key);
|
20
|
+
typedef NSString* (^YapDatabaseViewGroupingWithObjectBlock)(NSString *collection, NSString *key, id object);
|
21
|
+
typedef NSString* (^YapDatabaseViewGroupingWithMetadataBlock)(NSString *collection, NSString *key, id metadata);
|
22
|
+
typedef NSString* (^YapDatabaseViewGroupingWithRowBlock)(NSString *collection, NSString *key, id object, id metadata);
|
23
|
+
|
24
|
+
|
25
|
+
/**
|
26
|
+
* The sorting block handles sorting of objects within their group.
|
27
|
+
*
|
28
|
+
* After the view invokes the grouping block to determine what group a database row belongs to (if any),
|
29
|
+
* the view then needs to determine what index within that group the row should be.
|
30
|
+
* In order to do this, it needs to compare the new/updated row with existing rows in the same view group.
|
31
|
+
* This is what the sorting block is used for.
|
32
|
+
* So the sorting block will be invoked automatically during this process until the view has come to a conclusion.
|
33
|
+
*
|
34
|
+
* You should choose a block type that takes the minimum number of required parameters.
|
35
|
+
* The view can make various optimizations based on required parameters of the block.
|
36
|
+
*
|
37
|
+
* For example, if sorting is based on the object, and the metadata of a row is updated,
|
38
|
+
* then the view can deduce that the index hasn't changed (if the group hans't), and can skip this step.
|
39
|
+
*
|
40
|
+
* Performance Note:
|
41
|
+
*
|
42
|
+
* The view uses various optimizations (based on common patterns)
|
43
|
+
* to reduce the number of times it needs to invoke the sorting block.
|
44
|
+
*
|
45
|
+
* - Pattern : row is updated, but its index in the view doesn't change.
|
46
|
+
* Optimization : if an updated row doesn't change groups, the view will first compare it with
|
47
|
+
* objects to the left and right.
|
48
|
+
*
|
49
|
+
* - Pattern : rows are added to the beginning or end or a view
|
50
|
+
* Optimization : if the last change put an object at the beginning of the view, then it will test this quickly.
|
51
|
+
* if the last change put an object at the end of the view, then it will test this quickly.
|
52
|
+
*
|
53
|
+
* These optimizations offer huge performance benefits to many common cases.
|
54
|
+
* For example, adding objects to a view that are sorted by timestamp of when they arrived.
|
55
|
+
*
|
56
|
+
* The optimizations are not always performed.
|
57
|
+
* That is, if the row is added to a group it didn't previously belong,
|
58
|
+
* or if the last change didn't place an item at the beginning or end of the view.
|
59
|
+
*
|
60
|
+
* If optimizations fail, or are skipped, then the view uses a binary search algorithm.
|
61
|
+
*
|
62
|
+
* Although this may be considered "internal information",
|
63
|
+
* I feel it is important to explain for the following reason:
|
64
|
+
*
|
65
|
+
* Another common pattern is to fetch a number of objects in a batch, and then insert them into the database.
|
66
|
+
* Now imagine a situation in which the view is sorting posts based on timestamp,
|
67
|
+
* and you just fetched the most recent 10 posts. You can enumerate these 10 posts in forwards or backwards
|
68
|
+
* while adding them to the database. One direction will hit the optimization every time. The other will cause
|
69
|
+
* the view to perform a binary search every time. These little one-liner optimzations are easy.
|
70
|
+
**/
|
71
|
+
typedef id YapDatabaseViewSortingBlock; // One of the YapDatabaseViewSortingX types below.
|
72
|
+
|
73
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock) \
|
74
|
+
(NSString *group, NSString *collection1, NSString *key1, \
|
75
|
+
NSString *collection2, NSString *key2);
|
76
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock) \
|
77
|
+
(NSString *group, NSString *collection1, NSString *key1, id object1, \
|
78
|
+
NSString *collection2, NSString *key2, id object2);
|
79
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock) \
|
80
|
+
(NSString *group, NSString *collection1, NSString *key1, id metadata, \
|
81
|
+
NSString *collection2, NSString *key2, id metadata2);
|
82
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock) \
|
83
|
+
(NSString *group, NSString *collection1, NSString *key1, id object1, id metadata1, \
|
84
|
+
NSString *collection2, NSString *key2, id object2, id metadata2);
|
85
|
+
|
86
|
+
|
87
|
+
/**
|
88
|
+
* I wish there was a way to inspect a given block and see what kind of parameters it takes.
|
89
|
+
* Sadly this does not appear to be possible (at least not in any kind of standard legal way).
|
90
|
+
*
|
91
|
+
* Thus you will have to specify what kind of block you're passing.
|
92
|
+
**/
|
93
|
+
typedef enum {
|
94
|
+
YapDatabaseViewBlockTypeWithKey = 1,
|
95
|
+
YapDatabaseViewBlockTypeWithObject = 2,
|
96
|
+
YapDatabaseViewBlockTypeWithMetadata = 3,
|
97
|
+
YapDatabaseViewBlockTypeWithRow = 4
|
98
|
+
} YapDatabaseViewBlockType;
|
99
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#import "NSDictionary+YapDatabase.h"
|
2
|
+
|
3
|
+
|
4
|
+
@implementation NSDictionary (YapDatabase)
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Originally I named this method simply 'containsKey:'.
|
8
|
+
* But then immediately got a stack overflow when using the category.
|
9
|
+
*
|
10
|
+
* Apparently Apple's code actually registers the 'containsKey:' method in the objective-c space.
|
11
|
+
* And invoking CFDictionaryContainsKey results in a method call back to our 'containsKey:' method,
|
12
|
+
* and thus we get an infinite loop.
|
13
|
+
**/
|
14
|
+
- (BOOL)ydb_containsKey:(id)key
|
15
|
+
{
|
16
|
+
return CFDictionaryContainsKey((CFDictionaryRef)self, (const void *)key);
|
17
|
+
}
|
18
|
+
|
19
|
+
@end
|
@@ -63,6 +63,7 @@
|
|
63
63
|
- (void)removeObjectsForKeys:(NSArray *)keys;
|
64
64
|
|
65
65
|
- (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))block;
|
66
|
+
- (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block;
|
66
67
|
|
67
68
|
//
|
68
69
|
// Some debugging stuff that gets compiled out
|
@@ -402,6 +402,18 @@
|
|
402
402
|
}
|
403
403
|
}
|
404
404
|
|
405
|
+
- (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block
|
406
|
+
{
|
407
|
+
NSDictionary *nsdict = (__bridge NSDictionary *)cfdict;
|
408
|
+
|
409
|
+
[nsdict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
410
|
+
|
411
|
+
__unsafe_unretained YapCacheItem *cacheItem = (YapCacheItem *)obj;
|
412
|
+
|
413
|
+
block(key, cacheItem->value, stop);
|
414
|
+
}];
|
415
|
+
}
|
416
|
+
|
405
417
|
- (NSString *)description
|
406
418
|
{
|
407
419
|
NSMutableString *description = [NSMutableString string];
|
@@ -31,7 +31,7 @@
|
|
31
31
|
@property (nonatomic, assign, readwrite) YapDatabasePolicy metadataPolicy;
|
32
32
|
|
33
33
|
#if TARGET_OS_IPHONE
|
34
|
-
@property (nonatomic, assign, readwrite)
|
34
|
+
@property (nonatomic, assign, readwrite) YapDatabaseConnectionFlushMemoryFlags autoFlushMemoryFlags;
|
35
35
|
#endif
|
36
36
|
|
37
37
|
@end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
@synthesize metadataPolicy = metadataPolicy;
|
14
14
|
|
15
15
|
#if TARGET_OS_IPHONE
|
16
|
-
@synthesize
|
16
|
+
@synthesize autoFlushMemoryFlags = autoFlushMemoryFlags;
|
17
17
|
#endif
|
18
18
|
|
19
19
|
- (id)init
|
@@ -30,7 +30,7 @@
|
|
30
30
|
metadataPolicy = YapDatabasePolicyContainment;
|
31
31
|
|
32
32
|
#if TARGET_OS_IPHONE
|
33
|
-
|
33
|
+
autoFlushMemoryFlags = YapDatabaseConnectionFlushMemoryFlags_All;
|
34
34
|
#endif
|
35
35
|
}
|
36
36
|
return self;
|
@@ -50,7 +50,7 @@
|
|
50
50
|
copy->metadataPolicy = metadataPolicy;
|
51
51
|
|
52
52
|
#if TARGET_OS_IPHONE
|
53
|
-
copy->
|
53
|
+
copy->autoFlushMemoryFlags = autoFlushMemoryFlags;
|
54
54
|
#endif
|
55
55
|
|
56
56
|
return copy;
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
#import "YapCache.h"
|
10
10
|
#import "YapMemoryTable.h"
|
11
|
+
#import "YapCollectionKey.h"
|
11
12
|
|
12
13
|
#import "sqlite3.h"
|
13
14
|
|
@@ -25,6 +26,8 @@ NS_INLINE void sqlite_finalize_null(sqlite3_stmt **stmtPtr)
|
|
25
26
|
extern NSString *const YapDatabaseRegisteredExtensionsKey;
|
26
27
|
extern NSString *const YapDatabaseRegisteredTablesKey;
|
27
28
|
extern NSString *const YapDatabaseExtensionsOrderKey;
|
29
|
+
extern NSString *const YapDatabaseExtensionDependenciesKey;
|
30
|
+
extern NSString *const YapDatabaseRemovedRowidsKey;
|
28
31
|
extern NSString *const YapDatabaseNotificationKey;
|
29
32
|
|
30
33
|
@interface YapDatabase () {
|
@@ -41,8 +44,8 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
41
44
|
NSDictionary *registeredExtensions;
|
42
45
|
NSDictionary *registeredTables;
|
43
46
|
|
44
|
-
NSDictionary *extensionDependencies;
|
45
47
|
NSArray *extensionsOrder;
|
48
|
+
NSDictionary *extensionDependencies;
|
46
49
|
|
47
50
|
YapDatabaseConnection *registrationConnection;
|
48
51
|
|
@@ -81,6 +84,7 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
81
84
|
**/
|
82
85
|
- (BOOL)tableExists:(NSString *)tableName using:(sqlite3 *)aDb;
|
83
86
|
- (NSArray *)columnNamesForTable:(NSString *)tableName using:(sqlite3 *)aDb;
|
87
|
+
- (NSDictionary *)columnNamesAndAffinityForTable:(NSString *)tableName using:(sqlite3 *)aDb;
|
84
88
|
|
85
89
|
/**
|
86
90
|
* New connections inherit their default values from this structure.
|
@@ -104,6 +108,7 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
104
108
|
**/
|
105
109
|
- (NSDictionary *)registeredTables;
|
106
110
|
- (NSArray *)extensionsOrder;
|
111
|
+
- (NSDictionary *)extensionDependencies;
|
107
112
|
|
108
113
|
/**
|
109
114
|
* This method is only accessible from within the snapshotQueue.
|
@@ -182,13 +187,15 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
182
187
|
|
183
188
|
sqlite3 *db;
|
184
189
|
|
185
|
-
dispatch_queue_t connectionQueue; //
|
186
|
-
void *IsOnConnectionQueueKey; //
|
190
|
+
dispatch_queue_t connectionQueue; // For YapDatabaseExtensionConnection subclasses
|
191
|
+
void *IsOnConnectionQueueKey; // For YapDatabaseExtensionConnection subclasses
|
187
192
|
|
188
193
|
NSArray *extensionsOrder; // Read-only by YapDatabaseTransaction
|
194
|
+
NSDictionary *extensionDependencies; // Read-only for YapDatabaseExtensionTransaction subclasses
|
189
195
|
|
190
196
|
BOOL hasDiskChanges;
|
191
197
|
|
198
|
+
YapCache *keyCache;
|
192
199
|
YapCache *objectCache;
|
193
200
|
YapCache *metadataCache;
|
194
201
|
|
@@ -204,6 +211,7 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
204
211
|
NSMutableDictionary *metadataChanges;
|
205
212
|
NSMutableSet *removedKeys;
|
206
213
|
NSMutableSet *removedCollections;
|
214
|
+
NSMutableSet *removedRowids;
|
207
215
|
BOOL allKeysRemoved;
|
208
216
|
}
|
209
217
|
|
@@ -215,6 +223,7 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
215
223
|
|
216
224
|
- (sqlite3_stmt *)yapGetDataForKeyStatement; // Against "yap" database, for internal use
|
217
225
|
- (sqlite3_stmt *)yapSetDataForKeyStatement; // Against "yap" database, for internal use
|
226
|
+
- (sqlite3_stmt *)yapRemoveForKeyStatement; // Against "yap" database, for internal use
|
218
227
|
- (sqlite3_stmt *)yapRemoveExtensionStatement; // Against "yap" database, for internal use
|
219
228
|
|
220
229
|
- (sqlite3_stmt *)getCollectionCountStatement;
|
@@ -223,15 +232,15 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
223
232
|
- (sqlite3_stmt *)getCountForRowidStatement;
|
224
233
|
- (sqlite3_stmt *)getRowidForKeyStatement;
|
225
234
|
- (sqlite3_stmt *)getKeyForRowidStatement;
|
226
|
-
- (sqlite3_stmt *)getKeyDataForRowidStatement;
|
227
|
-
- (sqlite3_stmt *)getKeyMetadataForRowidStatement;
|
228
235
|
- (sqlite3_stmt *)getDataForRowidStatement;
|
236
|
+
- (sqlite3_stmt *)getMetadataForRowidStatement;
|
229
237
|
- (sqlite3_stmt *)getAllForRowidStatement;
|
230
238
|
- (sqlite3_stmt *)getDataForKeyStatement;
|
231
239
|
- (sqlite3_stmt *)getMetadataForKeyStatement;
|
232
240
|
- (sqlite3_stmt *)getAllForKeyStatement;
|
233
241
|
- (sqlite3_stmt *)insertForRowidStatement;
|
234
242
|
- (sqlite3_stmt *)updateAllForRowidStatement;
|
243
|
+
- (sqlite3_stmt *)updateObjectForRowidStatement;
|
235
244
|
- (sqlite3_stmt *)updateMetadataForRowidStatement;
|
236
245
|
- (sqlite3_stmt *)removeForRowidStatement;
|
237
246
|
- (sqlite3_stmt *)removeCollectionStatement;
|
@@ -330,33 +339,30 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
330
339
|
- (NSData *)dataValueForKey:(NSString *)key extension:(NSString *)extensionName;
|
331
340
|
- (void)setDataValue:(NSData *)value forKey:(NSString *)key extension:(NSString *)extensionName;
|
332
341
|
|
342
|
+
- (void)removeValueForKey:(NSString *)key extension:(NSString *)extensionName;
|
333
343
|
- (void)removeAllValuesForExtension:(NSString *)extensionName;
|
334
344
|
|
335
345
|
- (NSException *)mutationDuringEnumerationException;
|
336
346
|
|
337
347
|
- (BOOL)getRowid:(int64_t *)rowidPtr forKey:(NSString *)key inCollection:(NSString *)collection;
|
338
348
|
|
339
|
-
- (
|
349
|
+
- (YapCollectionKey *)collectionKeyForRowid:(int64_t)rowid;
|
340
350
|
|
341
|
-
- (BOOL)
|
342
|
-
|
343
|
-
object:(id *)objectPtr
|
344
|
-
forRowid:(int64_t)rowid;
|
351
|
+
- (BOOL)getCollectionKey:(YapCollectionKey **)collectionKeyPtr object:(id *)objectPtr forRowid:(int64_t)rowid;
|
352
|
+
- (BOOL)getCollectionKey:(YapCollectionKey **)collectionKeyPtr metadata:(id *)metadataPtr forRowid:(int64_t)rowid;
|
345
353
|
|
346
|
-
- (BOOL)
|
347
|
-
|
348
|
-
|
349
|
-
|
354
|
+
- (BOOL)getCollectionKey:(YapCollectionKey **)collectionKeyPtr
|
355
|
+
object:(id *)objectPtr
|
356
|
+
metadata:(id *)metadataPtr
|
357
|
+
forRowid:(int64_t)rowid;
|
350
358
|
|
351
|
-
- (BOOL)
|
352
|
-
collection:(NSString **)collectionPtr
|
353
|
-
object:(id *)objectPtr
|
354
|
-
metadata:(id *)metadataPtr
|
355
|
-
forRowid:(int64_t)rowid;
|
356
|
-
|
357
|
-
- (BOOL)hasRowForRowid:(int64_t)rowid;
|
359
|
+
- (BOOL)hasRowid:(int64_t)rowid;
|
358
360
|
|
359
361
|
- (id)objectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
362
|
+
- (id)objectForCollectionKey:(YapCollectionKey *)cacheKey withRowid:(int64_t)rowid;
|
363
|
+
|
364
|
+
- (id)metadataForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
365
|
+
- (id)metadataForCollectionKey:(YapCollectionKey *)cacheKey withRowid:(int64_t)rowid;
|
360
366
|
|
361
367
|
- (void)_enumerateKeysInCollection:(NSString *)collection
|
362
368
|
usingBlock:(void (^)(int64_t rowid, NSString *key, BOOL *stop))block;
|
@@ -422,3 +428,19 @@ extern NSString *const YapDatabaseNotificationKey;
|
|
422
428
|
withFilter:(BOOL (^)(int64_t rowid, NSString *collection, NSString *key))filter;
|
423
429
|
|
424
430
|
@end
|
431
|
+
|
432
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
433
|
+
#pragma mark -
|
434
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
435
|
+
|
436
|
+
@interface YapDatabaseReadWriteTransaction ()
|
437
|
+
|
438
|
+
- (void)replaceObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
439
|
+
- (void)replaceMetadata:(id)metadata
|
440
|
+
forKey:(NSString *)key
|
441
|
+
inCollection:(NSString *)collection
|
442
|
+
withRowid:(int64_t)rowid;
|
443
|
+
|
444
|
+
- (void)removeObjectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
445
|
+
|
446
|
+
@end
|
@@ -14,6 +14,9 @@
|
|
14
14
|
@property (nonatomic, strong, readonly) NSString *collection;
|
15
15
|
@property (nonatomic, strong, readonly) NSString *key;
|
16
16
|
|
17
|
+
- (BOOL)isEqualToCollectionKey:(YapCollectionKey *)collectionKey;
|
18
|
+
|
19
|
+
// These methods are overriden and optimized:
|
17
20
|
- (BOOL)isEqual:(id)anObject;
|
18
21
|
- (NSUInteger)hash;
|
19
22
|
|
@@ -166,6 +166,11 @@ static NSUInteger YDB_MurmurHash(NSUInteger hash1, NSUInteger hash2)
|
|
166
166
|
return self; // Immutable
|
167
167
|
}
|
168
168
|
|
169
|
+
- (BOOL)isEqualToCollectionKey:(YapCollectionKey *)collectionKey
|
170
|
+
{
|
171
|
+
return [key isEqualToString:collectionKey->key] && [collection isEqualToString:collectionKey->collection];
|
172
|
+
}
|
173
|
+
|
169
174
|
- (BOOL)isEqual:(id)obj
|
170
175
|
{
|
171
176
|
if ([obj isMemberOfClass:[YapCollectionKey class]])
|
@@ -330,7 +330,7 @@ extern NSString *const YapDatabaseAllKeysRemovedKey;
|
|
330
330
|
|
331
331
|
#if TARGET_OS_IPHONE
|
332
332
|
/**
|
333
|
-
* Allows you to set the default
|
333
|
+
* Allows you to set the default autoFlushMemoryFlags for all new connections.
|
334
334
|
*
|
335
335
|
* When you create a connection via [database newConnection], that new connection will inherit
|
336
336
|
* its initial configuration via the default values configured for the parent database.
|
@@ -339,12 +339,12 @@ extern NSString *const YapDatabaseAllKeysRemovedKey;
|
|
339
339
|
* Changing the default values only affects future connections that will be created.
|
340
340
|
* It does not affect connections that have already been created.
|
341
341
|
*
|
342
|
-
* The default
|
342
|
+
* The default defaultAutoFlushMemoryFlags is YapDatabaseConnectionFlushMemoryFlags_All.
|
343
343
|
*
|
344
344
|
* For more detailed documentation on these properties, see the YapDatabaseConnection header file.
|
345
|
-
* @see YapDatabaseConnection
|
345
|
+
* @see YapDatabaseConnection autoFlushMemoryFlags
|
346
346
|
**/
|
347
|
-
@property (atomic, assign, readwrite) int
|
347
|
+
@property (atomic, assign, readwrite) int defaultAutoFlushMemoryFlags;
|
348
348
|
#endif
|
349
349
|
|
350
350
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -35,12 +35,14 @@ NSString *const YapDatabaseObjectChangesKey = @"objectChanges";
|
|
35
35
|
NSString *const YapDatabaseMetadataChangesKey = @"metadataChanges";
|
36
36
|
NSString *const YapDatabaseRemovedKeysKey = @"removedKeys";
|
37
37
|
NSString *const YapDatabaseRemovedCollectionsKey = @"removedCollections";
|
38
|
+
NSString *const YapDatabaseRemovedRowidsKey = @"removedRowids";
|
38
39
|
NSString *const YapDatabaseAllKeysRemovedKey = @"allKeysRemoved";
|
39
40
|
|
40
|
-
NSString *const YapDatabaseRegisteredExtensionsKey
|
41
|
-
NSString *const YapDatabaseRegisteredTablesKey
|
42
|
-
NSString *const YapDatabaseExtensionsOrderKey
|
43
|
-
NSString *const
|
41
|
+
NSString *const YapDatabaseRegisteredExtensionsKey = @"registeredExtensions";
|
42
|
+
NSString *const YapDatabaseRegisteredTablesKey = @"registeredTables";
|
43
|
+
NSString *const YapDatabaseExtensionsOrderKey = @"extensionsOrder";
|
44
|
+
NSString *const YapDatabaseExtensionDependenciesKey = @"extensionDependencies";
|
45
|
+
NSString *const YapDatabaseNotificationKey = @"notification";
|
44
46
|
|
45
47
|
/**
|
46
48
|
* The database version is stored (via pragma user_version) to sqlite.
|
@@ -558,16 +560,16 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
558
560
|
}
|
559
561
|
|
560
562
|
/**
|
561
|
-
* Extracts and returns column names
|
563
|
+
* Extracts and returns column names from the given table in the database.
|
562
564
|
**/
|
563
565
|
- (NSArray *)columnNamesForTable:(NSString *)tableName using:(sqlite3 *)aDb
|
564
566
|
{
|
565
567
|
if (tableName == nil) return nil;
|
566
568
|
|
567
569
|
sqlite3_stmt *statement;
|
568
|
-
|
570
|
+
NSString *pragma = [NSString stringWithFormat:@"PRAGMA table_info('%@');", tableName];
|
569
571
|
|
570
|
-
int status = sqlite3_prepare_v2(aDb,
|
572
|
+
int status = sqlite3_prepare_v2(aDb, [pragma UTF8String], -1, &statement, NULL);
|
571
573
|
if (status != SQLITE_OK)
|
572
574
|
{
|
573
575
|
YDBLogError(@"%@: Error creating statement! %d %s", THIS_METHOD, status, sqlite3_errmsg(aDb));
|
@@ -576,8 +578,6 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
576
578
|
|
577
579
|
NSMutableArray *tableColumnNames = [NSMutableArray array];
|
578
580
|
|
579
|
-
sqlite3_bind_text(statement, 1, [tableName UTF8String], -1, SQLITE_TRANSIENT);
|
580
|
-
|
581
581
|
while ((status = sqlite3_step(statement)) == SQLITE_ROW)
|
582
582
|
{
|
583
583
|
const unsigned char *text = sqlite3_column_text(statement, 1);
|
@@ -601,6 +601,58 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
601
601
|
return tableColumnNames;
|
602
602
|
}
|
603
603
|
|
604
|
+
/**
|
605
|
+
* Extracts and returns column names & affinity for the given table in the database.
|
606
|
+
* The dictionary format is:
|
607
|
+
*
|
608
|
+
* key:(NSString *)columnName -> value:(NSString *)affinity
|
609
|
+
**/
|
610
|
+
- (NSDictionary *)columnNamesAndAffinityForTable:(NSString *)tableName using:(sqlite3 *)aDb
|
611
|
+
{
|
612
|
+
if (tableName == nil) return nil;
|
613
|
+
|
614
|
+
sqlite3_stmt *statement;
|
615
|
+
NSString *pragma = [NSString stringWithFormat:@"PRAGMA table_info('%@');", tableName];
|
616
|
+
|
617
|
+
int status = sqlite3_prepare_v2(aDb, [pragma UTF8String], -1, &statement, NULL);
|
618
|
+
if (status != SQLITE_OK)
|
619
|
+
{
|
620
|
+
YDBLogError(@"%@: Error creating statement! %d %s", THIS_METHOD, status, sqlite3_errmsg(aDb));
|
621
|
+
return nil;
|
622
|
+
}
|
623
|
+
|
624
|
+
NSMutableDictionary *columns = [NSMutableDictionary dictionary];
|
625
|
+
|
626
|
+
while ((status = sqlite3_step(statement)) == SQLITE_ROW)
|
627
|
+
{
|
628
|
+
// cid|name|type|notnull|dflt|value|pk
|
629
|
+
|
630
|
+
const unsigned char *_name = sqlite3_column_text(statement, 1);
|
631
|
+
int _nameSize = sqlite3_column_bytes(statement, 1);
|
632
|
+
|
633
|
+
const unsigned char *_type = sqlite3_column_text(statement, 2);
|
634
|
+
int _typeSize = sqlite3_column_bytes(statement, 2);
|
635
|
+
|
636
|
+
NSString *name = [[NSString alloc] initWithBytes:_name length:_nameSize encoding:NSUTF8StringEncoding];
|
637
|
+
NSString *affinity = [[NSString alloc] initWithBytes:_type length:_typeSize encoding:NSUTF8StringEncoding];
|
638
|
+
|
639
|
+
if (name && affinity)
|
640
|
+
{
|
641
|
+
[columns setObject:affinity forKey:name];
|
642
|
+
}
|
643
|
+
}
|
644
|
+
|
645
|
+
if (status != SQLITE_DONE)
|
646
|
+
{
|
647
|
+
YDBLogError(@"%@: Error executing statement! %d %s", THIS_METHOD, status, sqlite3_errmsg(aDb));
|
648
|
+
}
|
649
|
+
|
650
|
+
sqlite3_finalize(statement);
|
651
|
+
statement = NULL;
|
652
|
+
|
653
|
+
return columns;
|
654
|
+
}
|
655
|
+
|
604
656
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
605
657
|
#pragma mark Upgrade
|
606
658
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -805,7 +857,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
805
857
|
int status = status = sqlite3_exec(db, "BEGIN TRANSACTION;", NULL, NULL, NULL);
|
806
858
|
if (status != SQLITE_OK)
|
807
859
|
{
|
808
|
-
YDBLogError(@"Error in '%@': %d %s",
|
860
|
+
YDBLogError(@"Error in '%@': %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
809
861
|
}
|
810
862
|
}
|
811
863
|
|
@@ -814,7 +866,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
814
866
|
int status = status = sqlite3_exec(db, "COMMIT TRANSACTION;", NULL, NULL, NULL);
|
815
867
|
if (status != SQLITE_OK)
|
816
868
|
{
|
817
|
-
YDBLogError(@"Error in '%@': %d %s",
|
869
|
+
YDBLogError(@"Error in '%@': %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
818
870
|
}
|
819
871
|
}
|
820
872
|
|
@@ -828,8 +880,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
828
880
|
status = sqlite3_prepare_v2(db, stmt, (int)strlen(stmt)+1, &statement, NULL);
|
829
881
|
if (status != SQLITE_OK)
|
830
882
|
{
|
831
|
-
YDBLogError(@"%@: Error creating statement: %d %s",
|
832
|
-
NSStringFromSelector(_cmd), status, sqlite3_errmsg(db));
|
883
|
+
YDBLogError(@"%@: Error creating statement: %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
833
884
|
}
|
834
885
|
else
|
835
886
|
{
|
@@ -844,7 +895,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
844
895
|
status = sqlite3_step(statement);
|
845
896
|
if (status != SQLITE_DONE)
|
846
897
|
{
|
847
|
-
YDBLogError(@"%@: Error in statement: %d %s",
|
898
|
+
YDBLogError(@"%@: Error in statement: %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
848
899
|
}
|
849
900
|
|
850
901
|
sqlite3_finalize(statement);
|
@@ -863,8 +914,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
863
914
|
status = sqlite3_prepare_v2(db, stmt, (int)strlen(stmt)+1, &statement, NULL);
|
864
915
|
if (status != SQLITE_OK)
|
865
916
|
{
|
866
|
-
YDBLogError(@"%@: Error creating statement: %d %s",
|
867
|
-
NSStringFromSelector(_cmd), status, sqlite3_errmsg(db));
|
917
|
+
YDBLogError(@"%@: Error creating statement: %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
868
918
|
}
|
869
919
|
else
|
870
920
|
{
|
@@ -884,7 +934,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
884
934
|
|
885
935
|
if (status != SQLITE_DONE)
|
886
936
|
{
|
887
|
-
YDBLogError(@"%@: Error in statement: %d %s",
|
937
|
+
YDBLogError(@"%@: Error in statement: %d %s", THIS_METHOD, status, sqlite3_errmsg(db));
|
888
938
|
}
|
889
939
|
|
890
940
|
sqlite3_finalize(statement);
|
@@ -1031,23 +1081,23 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
1031
1081
|
|
1032
1082
|
#if TARGET_OS_IPHONE
|
1033
1083
|
|
1034
|
-
- (
|
1084
|
+
- (YapDatabaseConnectionFlushMemoryFlags)defaultAutoFlushMemoryFlags
|
1035
1085
|
{
|
1036
|
-
__block int result =
|
1086
|
+
__block int result = YapDatabaseConnectionFlushMemoryFlags_None;
|
1037
1087
|
|
1038
1088
|
dispatch_sync(internalQueue, ^{
|
1039
1089
|
|
1040
|
-
result = defaults.
|
1090
|
+
result = defaults.autoFlushMemoryFlags;
|
1041
1091
|
});
|
1042
1092
|
|
1043
1093
|
return result;
|
1044
1094
|
}
|
1045
1095
|
|
1046
|
-
- (void)
|
1096
|
+
- (void)setDefaultAutoFlushMemoryFlags:(YapDatabaseConnectionFlushMemoryFlags)defaultAutoFlushMemoryFlags
|
1047
1097
|
{
|
1048
1098
|
dispatch_sync(internalQueue, ^{
|
1049
1099
|
|
1050
|
-
defaults.
|
1100
|
+
defaults.autoFlushMemoryFlags = defaultAutoFlushMemoryFlags;
|
1051
1101
|
});
|
1052
1102
|
}
|
1053
1103
|
|
@@ -1340,36 +1390,9 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
1340
1390
|
return NO;
|
1341
1391
|
}
|
1342
1392
|
|
1343
|
-
// Set the registeredName now.
|
1344
|
-
// The extension will need this in order to perform the registration tasks such as creating tables, etc.
|
1345
|
-
|
1346
|
-
extension.registeredName = extensionName;
|
1347
|
-
|
1348
1393
|
// Attempt registration
|
1349
1394
|
|
1350
1395
|
BOOL result = [[self registrationConnection] registerExtension:extension withName:extensionName];
|
1351
|
-
if (result)
|
1352
|
-
{
|
1353
|
-
// Extension registered
|
1354
|
-
// Record dependencies (if there are any)
|
1355
|
-
|
1356
|
-
NSSet *dependencies = [extension dependencies];
|
1357
|
-
|
1358
|
-
if (dependencies == nil)
|
1359
|
-
dependencies = [NSSet set];
|
1360
|
-
|
1361
|
-
NSMutableDictionary *newExtensionDependencies = [extensionDependencies mutableCopy];
|
1362
|
-
[newExtensionDependencies setObject:dependencies forKey:extensionName];
|
1363
|
-
|
1364
|
-
extensionDependencies = [newExtensionDependencies copy];
|
1365
|
-
}
|
1366
|
-
else
|
1367
|
-
{
|
1368
|
-
// Registration failed
|
1369
|
-
|
1370
|
-
extension.registeredName = nil;
|
1371
|
-
}
|
1372
|
-
|
1373
1396
|
return result;
|
1374
1397
|
}
|
1375
1398
|
|
@@ -1387,51 +1410,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
1387
1410
|
return;
|
1388
1411
|
}
|
1389
1412
|
|
1390
|
-
YapDatabaseExtension *extension = [self registeredExtension:extensionName];
|
1391
|
-
|
1392
1413
|
[[self registrationConnection] unregisterExtension:extensionName];
|
1393
|
-
extension.registeredName = nil;
|
1394
|
-
|
1395
|
-
NSMutableDictionary *newExtensionDependencies = [extensionDependencies mutableCopy];
|
1396
|
-
[newExtensionDependencies removeObjectForKey:extensionName];
|
1397
|
-
|
1398
|
-
// Automatically unregister any extensions that were dependent upon this one.
|
1399
|
-
|
1400
|
-
BOOL done;
|
1401
|
-
do
|
1402
|
-
{
|
1403
|
-
__block NSString *dependentExtName = nil;
|
1404
|
-
[newExtensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
|
1405
|
-
|
1406
|
-
// __unsafe_unretained NSString *extName = (NSString *)key;
|
1407
|
-
__unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
|
1408
|
-
|
1409
|
-
if ([extDependencies containsObject:extensionName])
|
1410
|
-
{
|
1411
|
-
dependentExtName = (NSString *)key;
|
1412
|
-
*stop = YES;
|
1413
|
-
}
|
1414
|
-
}];
|
1415
|
-
|
1416
|
-
if (dependentExtName)
|
1417
|
-
{
|
1418
|
-
YapDatabaseExtension *dependentExt = [self registeredExtension:dependentExtName];
|
1419
|
-
|
1420
|
-
[[self registrationConnection] unregisterExtension:dependentExtName];
|
1421
|
-
dependentExt.registeredName = nil;
|
1422
|
-
|
1423
|
-
[newExtensionDependencies removeObjectForKey:dependentExtName];
|
1424
|
-
|
1425
|
-
done = NO;
|
1426
|
-
}
|
1427
|
-
else
|
1428
|
-
{
|
1429
|
-
done = YES;
|
1430
|
-
}
|
1431
|
-
|
1432
|
-
} while (!done);
|
1433
|
-
|
1434
|
-
extensionDependencies = [newExtensionDependencies copy];
|
1435
1414
|
}
|
1436
1415
|
|
1437
1416
|
/**
|
@@ -1490,6 +1469,17 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
1490
1469
|
return extensionsOrder;
|
1491
1470
|
}
|
1492
1471
|
|
1472
|
+
/**
|
1473
|
+
* This method is only accessible from within the snapshotQueue.
|
1474
|
+
* Used by [YapDatabaseConnection prepare].
|
1475
|
+
**/
|
1476
|
+
- (NSDictionary *)extensionDependencies
|
1477
|
+
{
|
1478
|
+
NSAssert(dispatch_get_specific(IsOnSnapshotQueueKey), @"Must go through snapshotQueue for atomic access.");
|
1479
|
+
|
1480
|
+
return extensionDependencies;
|
1481
|
+
}
|
1482
|
+
|
1493
1483
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
1494
1484
|
#pragma mark Pooling
|
1495
1485
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -1861,6 +1851,7 @@ NSString *const YapDatabaseNotificationKey = @"notification";
|
|
1861
1851
|
{
|
1862
1852
|
registeredExtensions = newRegisteredExtensions;
|
1863
1853
|
extensionsOrder = [changeset objectForKey:YapDatabaseExtensionsOrderKey];
|
1854
|
+
extensionDependencies = [changeset objectForKey:YapDatabaseExtensionDependenciesKey];
|
1864
1855
|
}
|
1865
1856
|
|
1866
1857
|
// Update registeredTables, if changed.
|