aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-06-05 15:07:25 +0000
committerbamse16 <marius@marius.me.uk>2009-06-05 15:07:25 +0000
commit67a3148cec8bc7d1c6f52f60c8ce93a4fe0b8ece (patch)
tree14dbf0a8861ade6a232dfe2d0fdfab0807375aa5 /Source/TablesList.m
parentb3d173a9bf9ade79a06202b5666b105936ef0dff (diff)
downloadsequelpro-67a3148cec8bc7d1c6f52f60c8ce93a4fe0b8ece.tar.gz
sequelpro-67a3148cec8bc7d1c6f52f60c8ce93a4fe0b8ece.tar.bz2
sequelpro-67a3148cec8bc7d1c6f52f60c8ce93a4fe0b8ece.zip
Fixed some memory leaks found using llvm/clang. There are still some to fix
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m15
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 716727d8..b5536fd9 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -482,15 +482,15 @@
[scanner scanUpToString:@"AS" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE VIEW %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
- [scanner release];
}
else if(tblType == SP_TABLETYPE_TABLE){
[scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
[scanner scanUpToString:@"(" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
- [scanner release];
}
+ [scanner release];
+
else if(tblType == SP_TABLETYPE_FUNC || tblType == SP_TABLETYPE_PROC)
{
// get the create syntax
@@ -516,7 +516,9 @@
tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
// replace the old name by the new one and drop the old one
- theResult = [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]];
+ [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]];
+ [tableSyntax release];
+
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't duplicate '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), [copyTableNameField stringValue], [mySQLConnection getLastErrorMessage]]);
@@ -651,7 +653,8 @@
tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
// replace the old name by the new one and drop the old one
- theResult = [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[tableRenameField stringValue] backtickQuotedString]]];
+ [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[tableRenameField stringValue] backtickQuotedString]]];
+ [tableSyntax release];
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[self tableName] backtickQuotedString]]];
@@ -983,7 +986,9 @@
tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]];
// replace the old name by the new one and drop the old one
- theResult = [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", tableType] withString:[anObject backtickQuotedString]]];
+ [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", tableType] withString:[anObject backtickQuotedString]]];
+ [tableSyntax release];
+
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[tables objectAtIndex:rowIndex] backtickQuotedString]]];