From fb40bf3e9dcc521c3607560bd330296a8968910e Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 7 Jul 2009 22:56:20 +0000 Subject: - Alter the "Allow Null" column in the source view to use a checkbox instead of an autocompleting combo cell. This addresses Issue #323. - Make the appearance of all checkbox columns consistent and disable automatic resizing with table - Correctly flush the CREATE TABLE and status caches on table structure changes to ensure the Extended Info tab is kept up to date with column changes --- Interfaces/English.lproj/DBView.xib | 289 ++++++++++++------------------------ Source/TableSource.m | 28 ++-- 2 files changed, 111 insertions(+), 206 deletions(-) diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 94d37f02..bc4c4629 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -8,8 +8,6 @@ 353.00 YES - - YES @@ -48,7 +46,7 @@ {3.40282e+38, 3.40282e+38} {780, 480} - + 256 YES @@ -188,7 +186,6 @@ {212, 381} - 6 @@ -220,7 +217,6 @@ {212, 381} - 528 @@ -319,7 +315,6 @@ {212, 145} - 6 @@ -346,7 +341,6 @@ {212, 145} - 512 @@ -619,7 +613,7 @@ source - + 256 YES @@ -666,7 +660,7 @@ YES Field - 9.300000e+01 + 9.700000e+01 4.000000e+01 1.000000e+03 @@ -818,7 +812,7 @@ Length - 6.500000e+01 + 7.300000e+01 1.000000e+01 1.000000e+03 @@ -845,7 +839,7 @@ unsigned - 6.400000e+01 + 5.500000e+01 1.000000e+01 1.000000e+03 @@ -856,19 +850,15 @@ - + 67239424 - 131072 + 0 - - LucidaGrande - 1.200000e+01 - 16 - + 1211912703 - 2 - + 130 + NSImage NSSwitch @@ -877,17 +867,17 @@ - 400 - 75 + 200 + 25 - 3 + 2 YES YES zerofill - 6.300000e+01 + 5.500000e+01 1.000000e+01 1.000000e+03 @@ -898,29 +888,29 @@ - + 67239424 - 131072 + 0 - + 1211912703 - 2 - + 130 + - 400 - 75 + 200 + 25 - 3 + 2 YES YES binary - 6.200000e+01 + 5.500000e+01 1.000000e+01 1.000000e+03 @@ -931,29 +921,29 @@ - + 67239424 - 131072 + 0 - + 1211912703 - 2 - + 130 + - 400 - 75 + 200 + 25 - 3 + 2 YES YES Null - 6.400000e+01 + 6.000000e+01 1.000000e+01 1.000000e+03 @@ -964,82 +954,29 @@ - - 337772097 - 133120 - Text Cell - + + 67239424 + 0 + + - - - 2 - YES - YES - - YES - YES - NO - - - - 274 - {13, 36} - - - YES - - YES - - - 1.000000e+01 - 1.000000e+01 - 1.000000e+03 - - 67239424 - 0 - - - - - - - 337772096 - 2048 - - - - - - 3 - YES - - - - 3.000000e+00 - 2.000000e+00 - - - 1.600000e+01 - tableViewAction: - -228556800 - - - - 1 - 15 - 0 - YES - - NO + 1211912703 + 130 + + + + + 200 + 25 - 3 + 2 YES YES Key - 5.900000e+01 + 5.500000e+01 1.000000e+01 1.000000e+03 @@ -1059,13 +996,13 @@ - 3 + 2 YES Default - 4.700000e+01 + 6.700000e+01 1.000000e+01 1.000000e+03 @@ -1193,7 +1130,6 @@ {{1, 17}, {688, 289}} - 4 @@ -1201,7 +1137,7 @@ -2147483392 - {{611, 17}, {15, 274}} + {{674, 17}, {15, 274}} _doScroller: @@ -1210,12 +1146,12 @@ -2147483392 - {{1, 291}, {610, 15}} + {{1, 291}, {673, 15}} 1 _doScroller: - 9.952229e-01 + 9.985486e-01 @@ -1226,7 +1162,6 @@ {{1, 0}, {688, 17}} - 4 @@ -1235,7 +1170,6 @@ {{-1, 22}, {690, 307}} - 562 @@ -1778,7 +1712,6 @@ {{1, 17}, {688, 142}} - 4 @@ -1811,7 +1744,6 @@ {{1, 0}, {688, 17}} - 4 @@ -1820,7 +1752,6 @@ {{-1, 22}, {690, 160}} - 562 @@ -1933,6 +1864,7 @@ {{10, 7}, {700, 544}} + Structure @@ -3975,7 +3907,7 @@ relations - + 256 YES @@ -4351,21 +4283,20 @@ {{10, 7}, {700, 544}} - Relations - + 134217731 YES YES YES - + @@ -4381,7 +4312,6 @@ {944, 550} - {{0, 0}, {1920, 1178}} {780, 502} @@ -5732,7 +5662,11 @@ 75628032 0 - + + LucidaGrande + 1.200000e+01 + 16 + @@ -6943,7 +6877,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {213, 50} - + 256 YES @@ -7057,7 +6991,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {379, 139} - {{0, 0}, {1920, 1178}} {213, 72} @@ -7748,6 +7681,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {370, 204}} + @@ -7777,6 +7711,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{-1, 35}, {383, 206}} + 18 @@ -8964,7 +8899,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {3.40282e+38, 3.40282e+38} {350, 250} - + 256 YES @@ -8983,7 +8918,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{128, 16}, {100, 26}} - YES -2076049856 @@ -9016,7 +8950,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{17, 22}, {109, 17}} - YES 68288064 @@ -9031,12 +8964,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 1}, {465, 60}} - {{-1, 233}, {467, 62}} - {0, 0} 67239424 @@ -9074,14 +9005,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {423, 141} - YES 256 {423, 17} - @@ -9089,7 +9018,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 -2147483392 {{-22, 0}, {12, 17}} - YES @@ -9165,7 +9093,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 17}, {423, 141}} - @@ -9176,7 +9103,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 -2147483392 {{413, 18}, {11, 140}} - 256 _doScroller: @@ -9187,7 +9113,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 256 {{-100, -100}, {227, 11}} - 257 _doScroller: @@ -9202,7 +9127,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{1, 0}, {423, 17}} - @@ -9212,7 +9136,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{20, 45}, {425, 159}} - 530 @@ -9227,7 +9150,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 268 {{17, 211}, {151, 13}} - YES 67239424 @@ -9244,7 +9166,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 {{286, 6}, {82, 32}} - YES 67239424 @@ -9270,7 +9191,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 289 {{368, 6}, {83, 32}} - 1 YES @@ -9294,7 +9214,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{20, 11}, {32, 24}} - YES 604110336 @@ -9319,7 +9238,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{51, 11}, {32, 24}} - 1 YES @@ -9346,7 +9264,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 292 {{88, 16}, {98, 14}} - YES 68288064 @@ -9360,8 +9277,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {465, 294} - - {{0, 0}, {1920, 1178}} {350, 272} @@ -18450,7 +18365,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - + @@ -18495,7 +18410,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - + @@ -18504,7 +18419,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - + @@ -18513,25 +18428,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - + - - 1307 - - - - - 1306 - - - - - 1305 - - - 1310 @@ -18552,11 +18452,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 - - 1326 - - - 1304 @@ -21362,6 +21257,26 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 + + 6239 + + + + + 6240 + + + + + 6241 + + + + + 6242 + + + @@ -21515,12 +21430,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1277.ImportedFromIB2 1304.IBPluginDependency 1304.ImportedFromIB2 - 1305.IBPluginDependency - 1305.ImportedFromIB2 - 1306.IBPluginDependency - 1306.ImportedFromIB2 - 1307.IBPluginDependency - 1307.ImportedFromIB2 1309.IBPluginDependency 1309.ImportedFromIB2 131.IBPluginDependency @@ -21556,8 +21465,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 1323.ImportedFromIB2 1325.IBPluginDependency 1325.ImportedFromIB2 - 1326.IBPluginDependency - 1326.ImportedFromIB2 133.IBPluginDependency 133.ImportedFromIB2 134.IBPluginDependency @@ -22649,6 +22556,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 6232.IBEditorWindowLastContentRect 6232.IBPluginDependency 6233.IBPluginDependency + 6239.IBPluginDependency + 6240.IBPluginDependency + 6241.IBPluginDependency + 6242.IBPluginDependency 654.IBPluginDependency 654.ImportedFromIB2 655.IBPluginDependency @@ -23085,12 +22996,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - CMCopyTable com.apple.InterfaceBuilder.CocoaPlugin @@ -23108,8 +23013,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - ToolTip @@ -24470,6 +24373,10 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -24689,7 +24596,7 @@ Y2hhbmdlIHRoZSBvcmRlcg - 6238 + 6244 diff --git a/Source/TableSource.m b/Source/TableSource.m index 58ecbf89..876c79d9 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -246,7 +246,7 @@ reloads the table (performing a new mysql-query) */ - (IBAction)reloadTable:(id)sender { - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; } @@ -266,7 +266,7 @@ reloads the table (performing a new mysql-query) int insertIndex = ([tableSourceView numberOfSelectedRows] == 0 ? [tableSourceView numberOfRows] : [tableSourceView selectedRow] + 1); [tableFields insertObject:[NSMutableDictionary - dictionaryWithObjects:[NSArray arrayWithObjects:@"", @"int", @"", @"0", @"0", @"0", ([prefs boolForKey:@"NewFieldsAllowNulls"]) ? @"YES" : @"NO", @"", [prefs stringForKey:@"NullValue"], @"None", nil] + dictionaryWithObjects:[NSArray arrayWithObjects:@"", @"int", @"", @"0", @"0", @"0", ([prefs boolForKey:@"NewFieldsAllowNulls"]) ? @"1" : @"0", @"", [prefs stringForKey:@"NullValue"], @"None", nil] forKeys:[NSArray arrayWithObjects:@"Field", @"Type", @"Length", @"unsigned", @"zerofill", @"binary", @"Null", @"Key", @"Default", @"Extra", nil]] atIndex:insertIndex]; @@ -348,7 +348,7 @@ reloads the table (performing a new mysql-query) [tempIndexedColumns componentsJoinedAndBacktickQuoted]]]; if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; [NSApp stopModalWithCode:1]; @@ -581,11 +581,9 @@ fetches the result as an array with a dictionary for each row in it [tempRow setObject:@"None" forKey:@"Extra"]; } if ( [[tempRow objectForKey:@"Null"] isEqualToString:@"YES"] ) { -// [tempRow setObject:[NSNumber numberWithInt:0] forKey:@"Null"]; - [tempRow setObject:@"YES" forKey:@"Null"]; + [tempRow setObject:@"1" forKey:@"Null"]; } else { -// [tempRow setObject:[NSNumber numberWithInt:1] forKey:@"Null"]; - [tempRow setObject:@"NO" forKey:@"Null"]; + [tempRow setObject:@"0" forKey:@"Null"]; } [tempResult addObject:tempRow]; } @@ -700,7 +698,7 @@ fetches the result as an array with a dictionary for each row in it [queryString appendString:@" BINARY"]; } - if ([[theRow objectForKey:@"Null"] isEqualToString:@"NO"]) { + if ([[theRow objectForKey:@"Null"] intValue] == 0) { [queryString appendString:@" NOT NULL"]; } else { [queryString appendString:@" NULL"]; @@ -713,7 +711,7 @@ fetches the result as an array with a dictionary for each row in it // If a null value has been specified, and null is allowed, specify DEFAULT NULL if ([[theRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"NullValue"]]) { - if ([[theRow objectForKey:@"Null"] isEqualToString:@"YES"]) { + if ([[theRow objectForKey:@"Null"] intValue] == 1) { [queryString appendString:@" DEFAULT NULL "]; } @@ -788,7 +786,7 @@ fetches the result as an array with a dictionary for each row in it isEditingNewRow = NO; currentlyEditingRow = -1; - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; @@ -856,7 +854,7 @@ fetches the result as an array with a dictionary for each row in it [selectedTable backtickQuotedString], [[[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"] backtickQuotedString]]]; if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; @@ -883,7 +881,7 @@ fetches the result as an array with a dictionary for each row in it } if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; } else { @@ -1156,7 +1154,7 @@ would result in a position change. if ([[originalRow objectForKey:@"binary"] isEqualToString:@"1"]) { [queryString appendString:@" BINARY"]; } - if ([[originalRow objectForKey:@"Null"] isEqualToString:@"NO"] ) { + if ([[originalRow objectForKey:@"Null"] isEqualToString:@"0"] ) { [queryString appendString:@" NOT NULL"]; } if (![[originalRow objectForKey:@"Extra"] isEqualToString:@"None"] ) { @@ -1166,7 +1164,7 @@ would result in a position change. // Add the default value if ([[originalRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"NullValue"]]) { - if ([[originalRow objectForKey:@"Null"] isEqualToString:@"YES"]) { + if ([[originalRow objectForKey:@"Null"] intValue] == 1) { [queryString appendString:@" DEFAULT NULL"]; } } else if ( [[originalRow objectForKey:@"Type"] isEqualToString:@"timestamp"] && ([[[originalRow objectForKey:@"Default"] uppercaseString] isEqualToString:@"CURRENT_TIMESTAMP"]) ) { @@ -1189,7 +1187,7 @@ would result in a position change. NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't move field. MySQL said: %@", @"message of panel when field cannot be added in drag&drop operation"), [mySQLConnection getLastErrorMessage]]); } else { - [tableDataInstance resetColumnData]; + [tableDataInstance resetAllData]; [tablesListInstance setStatusRequiresReload:YES]; [self loadTable:selectedTable]; -- cgit v1.2.3