diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-20 10:02:00 +0000 |
commit | d17a6b638e529694685a333162bbf6fec6c7fc08 (patch) | |
tree | 5c72506af7bf75299c093ce6a47b7cc4a956e0ff /Source/SPTableStructure.m | |
parent | dabf6466f11e5936ee871b8b3dd573020a142586 (diff) | |
download | sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.gz sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.tar.bz2 sequelpro-d17a6b638e529694685a333162bbf6fec6c7fc08.zip |
• overall replacement of:
[aString appendString:[NSString stringWithFormat:]] by
[aString appendFormat:]
since it's much more faster
• first look at loop where several [aStr appendString:] occur to try to combine them into one appendString or appendFormat since the allocation of memory takes really time
Note: I tested all my changes but we should test it further to be sure that I didn't a mistake!
Diffstat (limited to 'Source/SPTableStructure.m')
-rw-r--r-- | Source/SPTableStructure.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 0c51f083..ac490b82 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -784,11 +784,11 @@ closes the keySheet // If the field is of type BIT, permit the use of single qoutes and also don't quote the default value. // For example, use DEFAULT b'1' as opposed to DEFAULT 'b\'1\'' which results in an error. else if ([[theRow objectForKey:@"Type"] isEqualToString:@"bit"]) { - [queryString appendString:[NSString stringWithFormat:@" DEFAULT %@ ", [theRow objectForKey:@"Default"]]]; + [queryString appendFormat:@" DEFAULT %@ ", [theRow objectForKey:@"Default"]]; } // Otherwise, use the provided default else { - [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@' ", [mySQLConnection prepareString:[theRow objectForKey:@"Default"]]]]; + [queryString appendFormat:@" DEFAULT '%@' ", [mySQLConnection prepareString:[theRow objectForKey:@"Default"]]]; } } @@ -809,7 +809,7 @@ closes the keySheet // Any column comments if ([originalColumnDetails objectForKey:@"comment"] && [(NSString *)[originalColumnDetails objectForKey:@"comment"] length]) { - [queryString appendString:[NSString stringWithFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]]; + [queryString appendFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]; } // Unparsed details - column formats, storage, reference definitions @@ -842,22 +842,22 @@ closes the keySheet // Add AFTER ... only if the user added a new field if (isEditingNewRow) { - [queryString appendString:[NSString stringWithFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]]; + [queryString appendFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]; } } else { // Add AFTER ... only if the user added a new field if (isEditingNewRow) { - [queryString appendString:[NSString stringWithFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]]; + [queryString appendFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]; } - [queryString appendString:[NSString stringWithFormat:@", ADD %@ (%@)", [chooseKeyButton titleOfSelectedItem], [[theRow objectForKey:@"Field"] backtickQuotedString]]]; + [queryString appendFormat:@", ADD %@ (%@)", [chooseKeyButton titleOfSelectedItem], [[theRow objectForKey:@"Field"] backtickQuotedString]]; } } } // Add AFTER ... only if the user added a new field else if (isEditingNewRow) { - [queryString appendString:[NSString stringWithFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]]; + [queryString appendFormat:@" AFTER %@", [[[tableFields objectAtIndex:(currentlyEditingRow -1)] objectForKey:@"Field"] backtickQuotedString]]; } // Execute query @@ -1344,7 +1344,7 @@ would result in a position change. // Add the length parameter if necessary if ( [originalRow objectForKey:@"Length"] && ![[originalRow objectForKey:@"Length"] isEqualToString:@""]) { - [queryString appendString:[NSString stringWithFormat:@"(%@)", [originalRow objectForKey:@"Length"]]]; + [queryString appendFormat:@"(%@)", [originalRow objectForKey:@"Length"]]; } // Add unsigned, zerofill, binary, not null if necessary @@ -1377,7 +1377,7 @@ would result in a position change. [queryString appendString:@" DEFAULT CURRENT_TIMESTAMP"]; } else { - [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@'", [mySQLConnection prepareString:[originalRow objectForKey:@"Default"]]]]; + [queryString appendFormat:@" DEFAULT '%@'", [mySQLConnection prepareString:[originalRow objectForKey:@"Default"]]]; } // Add details not provided via the SHOW COLUMNS query from the table data cache so column details aren't lost @@ -1385,7 +1385,7 @@ would result in a position change. // Any column comments if ([originalColumnDetails objectForKey:@"comment"] && [(NSString *)[originalColumnDetails objectForKey:@"comment"] length]) { - [queryString appendString:[NSString stringWithFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]]; + [queryString appendFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]; } // Unparsed details - column formats, storage, reference definitions @@ -1397,8 +1397,8 @@ would result in a position change. if ( destinationRowIndex == 0 ){ [queryString appendString:@" FIRST"]; } else { - [queryString appendString:[NSString stringWithFormat:@" AFTER %@", - [[[tableFields objectAtIndex:destinationRowIndex-1] objectForKey:@"Field"] backtickQuotedString]]]; + [queryString appendFormat:@" AFTER %@", + [[[tableFields objectAtIndex:destinationRowIndex-1] objectForKey:@"Field"] backtickQuotedString]]; } // Run the query; report any errors, or reload the table on success |