diff options
Diffstat (limited to 'Source/SPViewCopy.m')
-rw-r--r-- | Source/SPViewCopy.m | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/SPViewCopy.m b/Source/SPViewCopy.m index 3a708696..5d69494c 100644 --- a/Source/SPViewCopy.m +++ b/Source/SPViewCopy.m @@ -45,14 +45,18 @@ NSMutableString *createStatement = [[NSMutableString alloc] initWithString:[self _createViewStatementFor:view inDatabase:sourceDatabase]]; NSString *search = [NSString stringWithFormat:@"VIEW %@", [view backtickQuotedString]]; - + NSRange range = [createStatement rangeOfString:search]; if (range.location != NSNotFound) { NSUInteger replaced = [createStatement replaceOccurrencesOfString:search withString:[NSString stringWithFormat:@"VIEW %@.%@", [targetDatabase backtickQuotedString], [view backtickQuotedString]] options:0 range:range]; - if (replaced != 1) return NO; + if (replaced != 1) { + [createStatement release]; + + return NO; + } // Replace all occurrences of the old database name [createStatement replaceOccurrencesOfString:[sourceDatabase backtickQuotedString] |