aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructureDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-05-12 20:57:57 +0000
committerstuconnolly <stuart02@gmail.com>2013-05-12 20:57:57 +0000
commitcae86c6943496128a61056b88a2c1c9420ce15ee (patch)
tree0087cf454007899b7981a0d53abb29d19db9b0a6 /Source/SPTableStructureDelegate.m
parent6d5741b74f72dab22eeb39ac4e601961baa005f8 (diff)
downloadsequelpro-cae86c6943496128a61056b88a2c1c9420ce15ee.tar.gz
sequelpro-cae86c6943496128a61056b88a2c1c9420ce15ee.tar.bz2
sequelpro-cae86c6943496128a61056b88a2c1c9420ce15ee.zip
Issue #1515: Add support for fractional seconds in date/time data types on server versions (>5.6.3) that support them.
Diffstat (limited to 'Source/SPTableStructureDelegate.m')
-rw-r--r--Source/SPTableStructureDelegate.m25
1 files changed, 14 insertions, 11 deletions
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index c2bdb98c..ec6e984f 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -548,37 +548,37 @@
[aCell setEnabled:NO];
}
else {
- // validate cell against current field type
+ // Validate cell against current field type
+ NSString *rowType = @"";
NSDictionary *theRow = NSArrayObjectAtIndex(tableFields, rowIndex);
- NSString *theRowType = @"";
- if ((theRowType = [theRow objectForKey:@"type"])) {
- theRowType = [[theRowType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
+ if ((rowType = [theRow objectForKey:@"type"])) {
+ rowType = [[rowType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
}
// Only string fields allow encoding settings
if (([[aTableColumn identifier] isEqualToString:@"encoding"])) {
- [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling])];
+ [aCell setEnabled:([fieldValidation isFieldTypeString:rowType] && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling])];
}
// Only string fields allow collation settings and string field is not set to BINARY since BINARY sets the collation to *_bin
else if ([[aTableColumn identifier] isEqualToString:@"collation"]) {
- [aCell setEnabled:([fieldValidation isFieldTypeString:theRowType] && [[theRow objectForKey:@"binary"] integerValue] == 0 && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling])];
+ [aCell setEnabled:([fieldValidation isFieldTypeString:rowType] && [[theRow objectForKey:@"binary"] integerValue] == 0 && [[tableDocumentInstance serverSupport] supportsPost41CharacterSetHandling])];
}
// Check if UNSIGNED and ZEROFILL is allowed
else if ([[aTableColumn identifier] isEqualToString:@"zerofill"] || [[aTableColumn identifier] isEqualToString:@"unsigned"]) {
- [aCell setEnabled:([fieldValidation isFieldTypeNumeric:theRowType] && ![theRowType isEqualToString:@"BIT"])];
+ [aCell setEnabled:([fieldValidation isFieldTypeNumeric:rowType] && ![rowType isEqualToString:@"BIT"])];
}
// Check if BINARY is allowed
else if ([[aTableColumn identifier] isEqualToString:@"binary"]) {
- [aCell setEnabled:([fieldValidation isFieldTypeAllowBinary:theRowType])];
+ [aCell setEnabled:([fieldValidation isFieldTypeAllowBinary:rowType])];
}
// TEXT, BLOB, and GEOMETRY fields don't allow a DEFAULT
else if ([[aTableColumn identifier] isEqualToString:@"default"]) {
- [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeGeometry:theRowType]) ? NO : YES];
+ [aCell setEnabled:([rowType hasSuffix:@"TEXT"] || [rowType hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeGeometry:rowType]) ? NO : YES];
}
// Check allow NULL
@@ -588,11 +588,14 @@
// TEXT, BLOB, date, and GEOMETRY fields don't allow a length
else if ([[aTableColumn identifier] isEqualToString:@"length"]) {
- [aCell setEnabled:([theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || ([fieldValidation isFieldTypeDate:theRowType] && ![theRowType isEqualToString:@"YEAR"]) || [fieldValidation isFieldTypeGeometry:theRowType]) ? NO : YES];
+ [aCell setEnabled:([rowType hasSuffix:@"TEXT"] ||
+ [rowType hasSuffix:@"BLOB"] ||
+ ([fieldValidation isFieldTypeDate:rowType] && ![[tableDocumentInstance serverSupport] supportsFractionalSeconds] && ![rowType isEqualToString:@"YEAR"]) ||
+ [fieldValidation isFieldTypeGeometry:rowType]) ? NO : YES];
}
else {
[aCell setEnabled:YES];
- }
+ }
}
}