aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-10-30 01:41:01 +0100
committerMax <post@wickenrode.com>2015-10-30 01:41:01 +0100
commitb2d798ba9282d3acf1a2d65de30849e529d4d255 (patch)
tree3d1efd017e3e6ef85a524b8d30c362ac02885885 /Source
parent2b2a177e7adceabadd451c0dca300b30f14aebb2 (diff)
downloadsequelpro-b2d798ba9282d3acf1a2d65de30849e529d4d255.tar.gz
sequelpro-b2d798ba9282d3acf1a2d65de30849e529d4d255.tar.bz2
sequelpro-b2d798ba9282d3acf1a2d65de30849e529d4d255.zip
* Lock connection during disconnect to prevent some race conditions
* Always use the server version name provided by mysql_get_server_info() as that should me more reliable * Use mysql_get_server_version() for version comparisons. Less code, official API and closer to what mysql does
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFieldMapperController.m4
-rw-r--r--Source/SPServerSupport.m13
2 files changed, 7 insertions, 10 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 9bef9d03..1a6cfc83 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -1043,9 +1043,7 @@ static NSUInteger SPSourceColumnTypeInteger = 1;
NSArray *encodings = [databaseDataInstance getDatabaseCharacterSetEncodings];
NSString *utf8MenuItemTitle = nil;
- if ([encodings count] > 0
- && ([mySQLConnection serverMajorVersion] > 4
- || ([mySQLConnection serverMajorVersion] == 4 && [mySQLConnection serverMinorVersion] >= 1)))
+ if ([encodings count] > 0 && ([mySQLConnection serverVersionIsGreaterThanOrEqualTo:4 minorVersion:1 releaseVersion:0]))
{
[[newTableInfoEncodingPopup menu] addItem:[NSMenuItem separatorItem]];
for (NSDictionary *encoding in encodings) {
diff --git a/Source/SPServerSupport.m b/Source/SPServerSupport.m
index a3b2a1a7..90a47b73 100644
--- a/Source/SPServerSupport.m
+++ b/Source/SPServerSupport.m
@@ -95,10 +95,9 @@
- (id)initWithMajorVersion:(NSInteger)majorVersion minor:(NSInteger)minorVersion release:(NSInteger)releaseVersion
{
if ((self = [super init])) {
- // Might be NSNotFound if unknown. unknown should also lose against "0".
- serverMajorVersion = (majorVersion != NSNotFound)? majorVersion : -1;
- serverMinorVersion = (minorVersion != NSNotFound)? minorVersion : -1;
- serverReleaseVersion = (releaseVersion != NSNotFound)? releaseVersion : -1;
+ serverMajorVersion = majorVersion;
+ serverMinorVersion = minorVersion;
+ serverReleaseVersion = releaseVersion;
// Determine what the server supports
[self evaluate];
@@ -363,9 +362,9 @@
- (void)dealloc
{
// Reset version integers
- serverMajorVersion = -1;
- serverMinorVersion = -1;
- serverReleaseVersion = -1;
+ serverMajorVersion = 0;
+ serverMinorVersion = 0;
+ serverReleaseVersion = 0;
// Invalidate all ivars
[self _invalidate];