aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructure.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-09-09 15:21:33 +0000
committerBibiko <bibiko@eva.mpg.de>2010-09-09 15:21:33 +0000
commitda8879c2d94f6f849cec202972e0bb595ff5865f (patch)
tree15aa0e0d29a5f3a0ead60b0217cf584b36d67627 /Source/SPTableStructure.m
parent09f05de9dacce173965aaff204a0254786580ab9 (diff)
downloadsequelpro-da8879c2d94f6f849cec202972e0bb595ff5865f.tar.gz
sequelpro-da8879c2d94f6f849cec202972e0bb595ff5865f.tar.bz2
sequelpro-da8879c2d94f6f849cec202972e0bb595ff5865f.zip
• [SPDatabase getDatabaseCollationsForEncoding:] now uses a cache to reduce the querying of info_schema
- this fixes the querying of each reloadData in [SPTableStructure objectValueFor:] • autoreleased mutableCopy in [SPTableStructure loadTable] • fixed drag&drop query in SPTableStructure to copy charset and collation as well
Diffstat (limited to 'Source/SPTableStructure.m')
-rw-r--r--Source/SPTableStructure.m21
1 files changed, 19 insertions, 2 deletions
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 2ec324a7..16c01b6f 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -118,7 +118,7 @@
// Make a mutable copy out of the cached [tableDataInstance columns] since we're adding infos
for(id col in [tableDataInstance columns])
- [theTableFields addObject:[col mutableCopy]];
+ [theTableFields addObject:[[col mutableCopy] autorelease]];
// Retrieve the indexes for the table
indexResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEX FROM %@", [aTable backtickQuotedString]]] retain];
@@ -760,7 +760,6 @@ closes the keySheet
[queryString appendFormat:@" COLLATE %@", col];
}
-
// Field specification
if ([[theRow objectForKey:@"unsigned"] integerValue] == 1) {
[queryString appendString:@" UNSIGNED"];
@@ -1385,6 +1384,24 @@ would result in a position change.
[queryString appendFormat:@"(%@)", [originalRow objectForKey:@"length"]];
}
+ NSString *fieldEncoding = @"";
+ if([[originalRow objectForKey:@"encoding"] integerValue] > 0) {
+ NSString *enc = [[[[[tableSourceView tableColumns] objectAtIndex:10] dataCell] itemAtIndex:[[originalRow objectForKey:@"encoding"] integerValue]] title];
+ NSInteger start = [enc rangeOfString:@"("].location+1;
+ NSInteger end = [enc length] - start - 1;
+ fieldEncoding = [enc substringWithRange:NSMakeRange(start, end)];
+ [queryString appendFormat:@" CHARACTER SET %@", fieldEncoding];
+ }
+ if(![fieldEncoding length] && [tableDataInstance tableEncoding]) {
+ fieldEncoding = [tableDataInstance tableEncoding];
+ }
+ if([fieldEncoding length] && [[originalRow objectForKey:@"collation"] integerValue] > 0) {
+ NSArray *theCollations = [databaseDataInstance getDatabaseCollationsForEncoding:fieldEncoding];
+ NSString *col = [[theCollations objectAtIndex:[[originalRow objectForKey:@"collation"] integerValue]-1] objectForKey:@"COLLATION_NAME"];
+ [queryString appendFormat:@" COLLATE %@", col];
+ }
+
+
// Add unsigned, zerofill, binary, not null if necessary
if ([[originalRow objectForKey:@"unsigned"] integerValue]) {
[queryString appendString:@" UNSIGNED"];