aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCopyTable.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-02-16 22:03:09 +0000
committerstuconnolly <stuart02@gmail.com>2013-02-16 22:03:09 +0000
commit27156550b646a74d2345b4ff9650b7a3b4ba052e (patch)
tree4f2608744fcef3524e1c208d860452a120e1a4ce /Source/SPCopyTable.m
parent624244dd35a6ca2e7942fbadbcaea756367b3453 (diff)
downloadsequelpro-27156550b646a74d2345b4ff9650b7a3b4ba052e.tar.gz
sequelpro-27156550b646a74d2345b4ff9650b7a3b4ba052e.tar.bz2
sequelpro-27156550b646a74d2345b4ff9650b7a3b4ba052e.zip
Fix more wanrings by creating a protocol that delegates of the copy table should conform to.
Diffstat (limited to 'Source/SPCopyTable.m')
-rw-r--r--Source/SPCopyTable.m22
1 files changed, 8 insertions, 14 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index c5d3f62d..807a204d 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -51,6 +51,7 @@
#endif
#import "SPTablesList.h"
#import "SPBundleCommandRunner.h"
+#import "SPDatabaseContentViewDelegate.h"
#import <SPMySQL/SPMySQL.h>
@@ -1185,19 +1186,8 @@ static const NSInteger kBlobAsImageFile = 4;
*/
- (BOOL)shouldUseFieldEditorForRow:(NSUInteger)rowIndex column:(NSUInteger)colIndex
{
-
// Retrieve the column definition
-#ifdef SP_CODA
- NSDictionary *columnDefinition = nil;
-
- if ( [[self delegate] isKindOfClass:[SPTableContent class]] )
- columnDefinition = [[(SPTableContent*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-
- else if ( [[self delegate] isKindOfClass:[SPCustomQuery class]] )
- columnDefinition = [[(SPCustomQuery*)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-#else
- NSDictionary *columnDefinition = [[[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
-#endif
+ NSDictionary *columnDefinition = [[(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions] objectAtIndex:colIndex];
NSString *columnType = [columnDefinition objectForKey:@"typegrouping"];
@@ -1368,7 +1358,9 @@ static const NSInteger kBlobAsImageFile = 4;
NSMutableString *tableMetaData = [NSMutableString string];
if([[self delegate] isKindOfClass:[SPCustomQuery class]]) {
[env setObject:@"query" forKey:SPBundleShellVariableDataTableSource];
- NSArray *defs = [[self delegate] dataColumnDefinitions];
+
+ NSArray *defs = [(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions];
+
if(defs && [defs count] == numColumns)
for( c = 0; c < numColumns; c++ ) {
NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]);
@@ -1383,7 +1375,9 @@ static const NSInteger kBlobAsImageFile = 4;
}
else if([[self delegate] isKindOfClass:[SPTableContent class]]) {
[env setObject:@"content" forKey:SPBundleShellVariableDataTableSource];
- NSArray *defs = [[self delegate] dataColumnDefinitions];
+
+ NSArray *defs = [(id <SPDatabaseContentViewDelegate>)[self delegate] dataColumnDefinitions];
+
if(defs && [defs count] == numColumns)
for( c = 0; c < numColumns; c++ ) {
NSDictionary *col = NSArrayObjectAtIndex(defs, columnMappings[c]);