From 3ca168863ddbdc3ac3bba0cfd9a64ce262cbfea8 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 18 Feb 2009 21:47:29 +0000 Subject: Sets and enforces a connection timeout, and handles connection timeouts appropriately - offering to retry, reconnect, or disconnect. This fixes Issue #93, Issue #69, and Issue #77. The gory details: Previously, MCPKit was correctly running mysql_ping to ensure a connection still existed before running a query, and aborted the query if the connection was no longer active.However the code very rarely checked the response of this, so if a query failed subsequent queries would continue to be run and the program would end up checking non-existent results, throwing Cocoa exceptions and generally breaking. However, mysql_ping would also use the default timeout (30 seconds) for each check - when running the (previous to r333) 14 queries to switch tables, this resulted in a long hang before the program even broke. To exacerbate the issue, certain situations triggered a bug present in mysql_ping in the old client binaries we're using (http://bugs.mysql.com/bug.php?id=9678), causing mysql_ping to never return despite the presence of a timeout, and so causing an indefinite hang. This issue has been fixed by: - Setting a new 10 second connection timeout for both new connections (Issue #69) and for mysql_pings. Once preferences have been redesigned we'll probably make this value editable. - Enforce the 10 second timeout even if mysql_ping hangs by using interrupts. - Wrap mysql_ping in a new method to do the above and also catch re-established connections without reporting false failures. - When a connection has failed, prompt the user to Retry, Reconnect, or Disconnect. Reconnect uses the original details for the old connection to establish a new connection, also attempting to preserve the current encoding. - Do not return control to the main loop until a connection has been reestablished (or disconnected) - this ensures the program is never in a broken state without having to rewrite all query usage. Much of the above patches the MCPKit connection methods as necessary. --- Interfaces/English.lproj/ConnectionErrorDialog.xib | 484 +++++++++++++++++++++ 1 file changed, 484 insertions(+) create mode 100644 Interfaces/English.lproj/ConnectionErrorDialog.xib (limited to 'Interfaces') diff --git a/Interfaces/English.lproj/ConnectionErrorDialog.xib b/Interfaces/English.lproj/ConnectionErrorDialog.xib new file mode 100644 index 00000000..f448beb9 --- /dev/null +++ b/Interfaces/English.lproj/ConnectionErrorDialog.xib @@ -0,0 +1,484 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSObject + + + FirstResponder + + + NSApplication + + + 1 + 2 + {{196, 355}, {533, 155}} + 603979776 + Connection Error + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 274 + {{112, 101}, {404, 34}} + + YES + + 67239424 + 272629760 + Sequel Pro appears to have lost the connection to the server, or the server has stopped responding. + + LucidaGrande + 1.300000e+01 + 1044 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 289 + {{423, 13}, {96, 32}} + + YES + + 67239424 + 134217728 + Retry + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 289 + {{318, 12}, {105, 32}} + + 1 + YES + + 67239424 + 134217728 + Reconnect + + + -2038284033 + 129 + + + 200 + 25 + + + + + 289 + {{170, 13}, {148, 32}} + + 2 + YES + + 67239424 + 134217728 + Close connection + + + -2038284033 + 129 + + + 200 + 25 + + + + + 256 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{20, 61}, {75, 74}} + + YES + + 130560 + 33554432 + + NSImage + appicon + + 0 + 0 + 0 + YES + + YES + + + + 256 + + YES + + YES + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + NSFilenamesPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT TIFF v4.0 pasteboard type + + + {{70, 57}, {32, 32}} + + YES + + 130560 + 33554432 + + NSImage + NSNetwork + + 0 + 0 + 0 + YES + + YES + + + {533, 155} + + + {{0, 0}, {1440, 878}} + {3.40282e+38, 3.40282e+38} + + + + + YES + + + connectionErrorDialog + + + + 21 + + + + closeSheet: + + + + 30 + + + + closeSheet: + + + + 31 + + + + closeSheet: + + + + 32 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + ConnectionErrorDialog + + + 2 + + + YES + + + + + + + + + + + 7 + + + YES + + + + + + 8 + + + + + 9 + + + YES + + + + + + 10 + + + + + 11 + + + YES + + + + + + 12 + + + + + 13 + + + YES + + + + + + 14 + + + + + 26 + + + YES + + + + + + 27 + + + + + 28 + + + YES + + + + + + 29 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 2.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + {{189, 637}, {533, 155}} + com.apple.InterfaceBuilder.CocoaPlugin + {{189, 637}, {533, 155}} + + 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 + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 32 + + + + YES + + NSObject + + closeSheet: + id + + + connectionErrorDialog + NSWindow + + + IBUserSource + + + + + + 0 + ../sequel-pro.xcodeproj + 3 + + -- cgit v1.2.3