aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMTextView.h4
-rw-r--r--Source/CustomQuery.h2
-rw-r--r--Source/CustomQuery.m2
-rw-r--r--Source/NSNotificationAdditions.h2
-rw-r--r--Source/NSNotificationAdditions.m2
-rw-r--r--Source/SPAboutController.m3
-rw-r--r--Source/SPArrayAdditions.h11
-rw-r--r--Source/SPConsoleMessage.m4
-rw-r--r--Source/SPConstants.h53
-rw-r--r--Source/SPConstants.m7
-rw-r--r--Source/SPContentFilterManager.m5
-rw-r--r--Source/SPDatabaseData.h10
-rw-r--r--Source/SPDatabaseData.m8
-rw-r--r--Source/SPFieldEditorController.m1
-rw-r--r--Source/SPFieldMapperController.h6
-rw-r--r--Source/SPGrowlController.h8
-rw-r--r--Source/SPGrowlController.m8
-rw-r--r--Source/SPHistoryController.h9
-rw-r--r--Source/SPHistoryController.m23
-rw-r--r--Source/SPNarrowDownCompletion.h2
-rw-r--r--Source/SPNarrowDownCompletion.m5
-rw-r--r--Source/SPNavigatorController.h6
-rw-r--r--Source/SPNavigatorController.m2
-rw-r--r--Source/SPPreferenceController.m2
-rw-r--r--Source/SPQueryController.m16
-rw-r--r--Source/SPSSHTunnel.h7
-rw-r--r--Source/SPSSHTunnel.m6
-rw-r--r--Source/SPTableData.m27
-rw-r--r--Source/SPTableInfo.m10
-rw-r--r--Source/SPTableRelations.m6
-rw-r--r--Source/SPTableTriggers.m2
-rw-r--r--Source/SequelProTunnelAssistant.m6
-rw-r--r--Source/TableDocument.m35
-rw-r--r--Source/TableDump.h9
-rw-r--r--Source/TableDump.m20
-rw-r--r--Source/TableSource.m18
-rw-r--r--Source/TablesList.h9
-rw-r--r--Source/TablesList.m218
38 files changed, 293 insertions, 281 deletions
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index b00c4b33..4e96ad39 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -46,7 +46,8 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
return r;
}
-@interface CMTextView : NSTextView {
+@interface CMTextView : NSTextView
+{
BOOL autoindentEnabled;
BOOL autopairEnabled;
BOOL autoindentIgnoresEnter;
@@ -91,7 +92,6 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS
NSColor *otherTextColor;
NSRange queryRange;
BOOL shouldHiliteQuery;
-
}
@property(retain) NSColor* queryHiliteColor;
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index a59fb828..039f3a29 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -40,8 +40,6 @@
#define SP_HELP_GOFORWARD_BUTTON 2
#define SP_HELP_NOT_AVAILABLE @"__no_help_available"
-#define SP_MYSQL_DEV_SEARCH_URL @"http://search.mysql.com/search?q=%@&site=refman-%@"
-
#define SP_SAVE_ALL_FAVORTITE_MENUITEM_TAG 100001
#define SP_SAVE_SELECTION_FAVORTITE_MENUITEM_TAG 100000
#define SP_FAVORITE_HEADER_MENUITEM_TAG 200000
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index c1ffa4f0..6fe9bf8a 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -2541,7 +2541,7 @@
version = [mySQLversion stringByReplacingOccurrencesOfString:@"." withString:@""];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:
[[NSString stringWithFormat:
- SP_MYSQL_DEV_SEARCH_URL,
+ SPMySQLSearchURL,
searchString,
version]
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];
diff --git a/Source/NSNotificationAdditions.h b/Source/NSNotificationAdditions.h
index 37fe4c0e..ff303465 100644
--- a/Source/NSNotificationAdditions.h
+++ b/Source/NSNotificationAdditions.h
@@ -25,10 +25,12 @@
// More info at <http://code.google.com/p/sequel-pro/>
@interface NSNotificationCenter (NSNotificationCenterAdditions)
+
- (void) postNotificationOnMainThread:(NSNotification *) notification;
- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait;
- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object;
- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo;
- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait;
+
@end
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m
index 2e075ed3..3e5e3cc8 100644
--- a/Source/NSNotificationAdditions.m
+++ b/Source/NSNotificationAdditions.m
@@ -28,6 +28,7 @@
#import <pthread.h>
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
+
- (void) postNotificationOnMainThread:(NSNotification *) notification {
if( pthread_main_np() ) return [self postNotification:notification];
[self postNotificationOnMainThread:notification waitUntilDone:NO];
@@ -72,4 +73,5 @@
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
+
@end
diff --git a/Source/SPAboutController.m b/Source/SPAboutController.m
index 4e5c94f9..0e0e7a09 100644
--- a/Source/SPAboutController.m
+++ b/Source/SPAboutController.m
@@ -40,11 +40,10 @@
*/
- (void)awakeFromNib
{
- BOOL isNightly = NO;
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
// If the version string has a prefix of 'Nightly' then this is obviously a nighly build.
- if ([version hasPrefix:@"Nightly"]) isNightly = YES;
+ BOOL isNightly = [version hasPrefix:@"Nightly"];
// Set the application name, but only include the major version if this is not a nightly build.
[appNameVersionTextField setStringValue:(isNightly) ? @"Sequel Pro" : [NSString stringWithFormat:@"Sequel Pro %@", version]];
diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h
index 2c3ce7c4..284e588a 100644
--- a/Source/SPArrayAdditions.h
+++ b/Source/SPArrayAdditions.h
@@ -24,13 +24,18 @@
#import <Cocoa/Cocoa.h>
-static inline id NSArrayObjectAtIndex(NSArray* self, NSUInteger i) {
+static inline id NSArrayObjectAtIndex(NSArray *self, NSUInteger i)
+{
return (id)CFArrayGetValueAtIndex((CFArrayRef)self, i);
}
-static inline void NSMutableArrayAddObject(NSArray* self, id anObject) {
+
+static inline void NSMutableArrayAddObject(NSArray *self, id anObject)
+{
CFArrayAppendValue((CFMutableArrayRef)self, anObject);
}
-static inline void NSMutableArrayReplaceObject(NSArray* self, CFIndex idx, id anObject) {
+
+static inline void NSMutableArrayReplaceObject(NSArray *self, CFIndex idx, id anObject)
+{
CFArraySetValueAtIndex((CFMutableArrayRef)self, idx, anObject);
}
diff --git a/Source/SPConsoleMessage.m b/Source/SPConsoleMessage.m
index e851a9ef..995fe084 100644
--- a/Source/SPConsoleMessage.m
+++ b/Source/SPConsoleMessage.m
@@ -33,7 +33,7 @@
@synthesize messageConnection;
/**
- *
+ * Returns a new console message instance using the suppled message, date and connection.
*/
+ (SPConsoleMessage *)consoleMessageWithMessage:(NSString *)message date:(NSDate *)date connection:(NSString *)connection
{
@@ -41,7 +41,7 @@
}
/**
- *
+ * Initializes a new console message instance using the suppled message, date and connection.
*/
- (id)initWithMessage:(NSString *)consoleMessage date:(NSDate *)date connection:(NSString *)connection
{
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index ddc31be3..f5828b96 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -27,11 +27,11 @@
// View modes
typedef enum {
- SPStructureViewMode = 1,
- SPContentViewMode = 2,
- SPRelationsViewMode = 3,
- SPTableInfoViewMode = 4,
- SPQueryEditorViewMode = 5
+ SPStructureViewMode = 1,
+ SPContentViewMode = 2,
+ SPRelationsViewMode = 3,
+ SPTableInfoViewMode = 4,
+ SPQueryEditorViewMode = 5
} SPViewMode;
// Query modes
@@ -55,6 +55,48 @@ typedef enum {
SPRowCountFetchAlways = 2
} SPRowCountQueryUsageLevels;
+// Export type
+typedef enum {
+ SPExportingSQL = 0,
+ SPExportingCSV = 1,
+ SPExportingXML = 2,
+ SPExportingDOT = 3
+} SPExportMode;
+
+// Database object (table list) types
+typedef enum
+{
+ SPTableTypeNone = -1,
+ SPTableTypeTable = 0,
+ SPTableTypeView = 1,
+ SPTableTypeProc = 2,
+ SPTableTypeFunc = 3
+} SPTableType;
+
+// History views
+typedef enum
+{
+ SPHistoryViewStructure = 0,
+ SPHistoryViewContent = 1,
+ SPHistoryViewCustomQuery = 2,
+ SPHistoryViewStatus = 3,
+ SPHistoryViewRelations = 4
+} SPHistoryViewType;
+
+// SSH tunnel password modes
+typedef enum
+{
+ SPSSHPasswordUsesKeychain = 0,
+ SPSSHPasswordAsksUI = 1,
+ SPSSHPasswordNone = 2
+} SPSSHTunnelPasswordMode;
+
+// Long running notification time for Growl messages
+extern const CGFloat SPLongRunningNotificationTime;
+
+// Narrow down completion max rows
+extern const NSUInteger SPNarrowDownCompletionMaxRows;
+
// Kill mode constants
extern NSString *SPKillProcessQueryMode;
extern NSString *SPKillProcessConnectionMode;
@@ -192,6 +234,7 @@ extern NSString *SPFAQURL;
extern NSString *SPDocumentationURL;
extern NSString *SPContactURL;
extern NSString *SPKeyboardShortcutsURL;
+extern NSString *SPMySQLSearchURL;
// Toolbar constants
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 82a92bc7..68fa162f 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -25,6 +25,12 @@
#import "SPConstants.h"
+// Long running notification time for Growl messages
+const CGFloat SPLongRunningNotificationTime = 3.0;
+
+// Narrow down completion max rows
+const NSUInteger SPNarrowDownCompletionMaxRows = 15;
+
// Kill mode constants
NSString *SPKillProcessQueryMode = @"SPKillProcessQueryMode";
NSString *SPKillProcessConnectionMode = @"SPKillProcessConnectionMode";
@@ -160,6 +166,7 @@ NSString *SPFAQURL = @"http://www.sequelpro.com/do
NSString *SPDocumentationURL = @"http://www.sequelpro.com/docs/";
NSString *SPContactURL = @"http://www.sequelpro.com/docs/Contact_the_developers";
NSString *SPKeyboardShortcutsURL = @"http://www.sequelpro.com/docs/Keyboard_Shortcuts";
+NSString *SPMySQLSearchURL = @"http://search.mysql.com/search?q=%@&site=refman-%@";
// Toolbar constants
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index 8e79cc8e..30defe7a 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -34,8 +34,10 @@
#define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]")
#define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]")
-@interface SPContentFilterManager (Private)
+@interface SPContentFilterManager (PrivateAPI)
+
- (void)_initWithNoSelection;
+
@end
@implementation SPContentFilterManager
@@ -877,4 +879,5 @@
[contentFilterNameTextField setStringValue:@""];
[contentFilterTextView setString:@""];
}
+
@end
diff --git a/Source/SPDatabaseData.h b/Source/SPDatabaseData.h
index d4bbf36c..acfbd37c 100644
--- a/Source/SPDatabaseData.h
+++ b/Source/SPDatabaseData.h
@@ -26,13 +26,13 @@
#import <Cocoa/Cocoa.h>
#import <MCPKit/MCPKit.h>
-typedef struct _CHAR_SETS
+typedef struct
{
NSUInteger nr;
- const char *name;
- const char *collation;
- const char *description;
-} CHAR_SETS;
+ const char *name;
+ const char *collation;
+ const char *description;
+} SPDatabaseCharSets;
@interface SPDatabaseData : NSObject
{
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m
index 78b4295e..4e40f998 100644
--- a/Source/SPDatabaseData.m
+++ b/Source/SPDatabaseData.m
@@ -32,7 +32,7 @@
@end
-const CHAR_SETS charsets[] =
+const SPDatabaseCharSets charsets[] =
{
{ 1, "big5","big5_chinese_ci", "Big5 Traditional Chinese"},
{ 3, "dec8", "dec8_swedisch_ci", "DEC West European"},
@@ -239,7 +239,7 @@ const CHAR_SETS charsets[] =
// If that failed, get the list of collations from the hard-coded list
if (![collations count]) {
- const CHAR_SETS *c = charsets;
+ const SPDatabaseCharSets *c = charsets;
do {
[collations addObject:[NSString stringWithCString:c->collation encoding:NSUTF8StringEncoding]];
@@ -272,7 +272,7 @@ const CHAR_SETS charsets[] =
// If that failed, get the list of collations matching the supplied encoding from the hard-coded list
if (![characterSetCollations count]) {
- const CHAR_SETS *c = charsets;
+ const SPDatabaseCharSets *c = charsets;
do {
NSString *charSet = [NSString stringWithCString:c->name encoding:NSUTF8StringEncoding];
@@ -385,7 +385,7 @@ const CHAR_SETS charsets[] =
// If that failed, get the list of character set encodings from the hard-coded list
if (![characterSetEncodings count]) {
- const CHAR_SETS *c = charsets;
+ const SPDatabaseCharSets *c = charsets;
do {
[characterSetEncodings addObject:[NSDictionary dictionaryWithObjectsAndKeys:
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 2db46a10..6a481daa 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -945,6 +945,7 @@
return YES;
}
}
+
return NO;
}
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index ed66979c..3f94602c 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -26,8 +26,8 @@
#import <MCPKit/MCPKit.h>
#import "CMTextView.h"
-@interface SPFieldMapperController : NSWindowController {
-
+@interface SPFieldMapperController : NSWindowController
+{
IBOutlet NSTableView *fieldMapperTableView;
IBOutlet id fieldMapperTableScrollView;
IBOutlet NSTableView *globalValuesTableView;
@@ -112,7 +112,6 @@
NSInteger heightOffset;
NSUInteger windowMinWidth;
NSUInteger windowMinHeigth;
-
}
@property(retain) NSString* sourcePath;
@@ -153,7 +152,6 @@
- (IBAction)closeGlobalValuesSheet:(id)sender;
- (IBAction)advancedCheckboxValidation:(id)sender;
-
// Others
- (void)resizeWindowByHeightDelta:(NSInteger)delta;
- (void)matchHeaderNames;
diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h
index f3bac6d2..410ce914 100644
--- a/Source/SPGrowlController.h
+++ b/Source/SPGrowlController.h
@@ -26,8 +26,6 @@
#import <Cocoa/Cocoa.h>
#import <Growl/Growl.h>
-#define SP_LONGRUNNING_NOTIFICATION_TIME 3.0
-
@interface SPGrowlController : NSObject <GrowlApplicationBridgeDelegate>
{
NSString *timingNotificationName;
@@ -55,10 +53,10 @@
clickContext:(id)clickContext;
// Receive notification click
-- (void) growlNotificationWasClicked:(NSDictionary *)clickContext;
+- (void)growlNotificationWasClicked:(NSDictionary *)clickContext;
// Timing functions
-- (void) setVisibilityForNotificationName:(NSString *)name;
-- (double) milliTime;
+- (void)setVisibilityForNotificationName:(NSString *)name;
+- (double)milliTime;
@end
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 13d06f3c..91690546 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -130,7 +130,7 @@ static SPGrowlController *sharedGrowlController = nil;
// if it does, and the time exceeds the threshold, display the notification even for
// frontmost windows to provide feedback for long-running tasks.
if (timingNotificationName && [timingNotificationName isEqualToString:name]) {
- if ([self milliTime] > (SP_LONGRUNNING_NOTIFICATION_TIME * 1000) + timingNotificationStart) {
+ if ([self milliTime] > (SPLongRunningNotificationTime * 1000) + timingNotificationStart) {
postNotification = YES;
}
[timingNotificationName release], timingNotificationName = nil;
@@ -151,7 +151,7 @@ static SPGrowlController *sharedGrowlController = nil;
/**
* React to a click on the notification.
*/
-- (void) growlNotificationWasClicked:(NSDictionary *)clickContext
+- (void)growlNotificationWasClicked:(NSDictionary *)clickContext
{
if (clickContext && [clickContext objectForKey:@"notificationWindow"]) {
NSWindow *targetWindow = [NSApp windowWithWindowNumber:[[clickContext objectForKey:@"notificationWindow"] integerValue]];
@@ -168,7 +168,7 @@ static SPGrowlController *sharedGrowlController = nil;
* being posted; if the notification is posted after the header-defined boundary, the
* notification will then be shown even if the app is frontmost.
*/
-- (void) setVisibilityForNotificationName:(NSString *)name
+- (void)setVisibilityForNotificationName:(NSString *)name
{
if (timingNotificationName) [timingNotificationName release], timingNotificationName = nil;
timingNotificationName = [[NSString alloc] initWithString:name];
@@ -178,7 +178,7 @@ static SPGrowlController *sharedGrowlController = nil;
/**
* Get a monotonically increasing time, in milliseconds.
*/
-- (double) milliTime
+- (double)milliTime
{
uint64_t currentTime_t = mach_absolute_time();
Nanoseconds elapsedTime = AbsoluteToNanoseconds(*(AbsoluteTime *)&(currentTime_t));
diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h
index dd5c7133..171e8474 100644
--- a/Source/SPHistoryController.h
+++ b/Source/SPHistoryController.h
@@ -26,15 +26,6 @@
@class TableDocument, TableContent, TablesList;
-enum sphistory_view_types
-{
- SP_VIEW_STRUCTURE = 0,
- SP_VIEW_CONTENT = 1,
- SP_VIEW_CUSTOMQUERY = 2,
- SP_VIEW_STATUS = 3,
- SP_VIEW_RELATIONS = 4
-};
-
@interface SPHistoryController : NSObject
{
IBOutlet TableDocument *theDocument;
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index c1c6b386..aae33e81 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -25,6 +25,7 @@
#import "TableDocument.h"
#import "TableContent.h"
#import "TablesList.h"
+#import "SPConstants.h"
#import "SPHistoryController.h"
#import "SPStringAdditions.h"
#import "SPMainThreadTrampoline.h"
@@ -156,15 +157,15 @@
NSString *viewName = [[[theDocument valueForKey:@"tableTabView"] selectedTabViewItem] identifier];
if ([viewName isEqualToString:@"source"]) {
- theView = SP_VIEW_STRUCTURE;
+ theView = SPHistoryViewStructure;
} else if ([viewName isEqualToString:@"content"]) {
- theView = SP_VIEW_CONTENT;
+ theView = SPHistoryViewContent;
} else if ([viewName isEqualToString:@"customQuery"]) {
- theView = SP_VIEW_CUSTOMQUERY;
+ theView = SPHistoryViewCustomQuery;
} else if ([viewName isEqualToString:@"status"]) {
- theView = SP_VIEW_STATUS;
+ theView = SPHistoryViewStatus;
} else if ([viewName isEqualToString:@"relations"]) {
- theView = SP_VIEW_RELATIONS;
+ theView = SPHistoryViewRelations;
}
return theView;
@@ -315,7 +316,7 @@
// If the database, table, and view are the same and content - just trigger a table reload (filters)
if ([[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]]
&& [historyEntry objectForKey:@"table"] && [[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]
- && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SP_VIEW_CONTENT)
+ && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SPHistoryViewContent)
{
[tableContentInstance loadTable:[historyEntry objectForKey:@"table"]];
modifyingState = NO;
@@ -346,19 +347,19 @@
// Check and set the view
if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) {
switch ([[historyEntry objectForKey:@"view"] integerValue]) {
- case SP_VIEW_STRUCTURE:
+ case SPHistoryViewStructure:
[theDocument viewStructure:self];
break;
- case SP_VIEW_CONTENT:
+ case SPHistoryViewContent:
[theDocument viewContent:self];
break;
- case SP_VIEW_CUSTOMQUERY:
+ case SPHistoryViewCustomQuery:
[theDocument viewQuery:self];
break;
- case SP_VIEW_STATUS:
+ case SPHistoryViewStatus:
[theDocument viewStatus:self];
break;
- case SP_VIEW_RELATIONS:
+ case SPHistoryViewRelations:
[theDocument viewRelations:self];
break;
}
diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h
index 39977328..e2aaed5e 100644
--- a/Source/SPNarrowDownCompletion.h
+++ b/Source/SPNarrowDownCompletion.h
@@ -28,8 +28,6 @@
#import <Cocoa/Cocoa.h>
-#define SP_NARROWDOWNLIST_MAX_ROWS 15
-
@interface SPNarrowDownCompletion : NSWindow
{
NSArray* suggestions;
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index de9d39aa..40cbd2d9 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -27,6 +27,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <Foundation/NSObjCRuntime.h>
+#import <tgmath.h>
#import "SPNarrowDownCompletion.h"
#import "SPArrayAdditions.h"
@@ -36,7 +37,7 @@
#import "SPQueryController.h"
#import "RegexKitLite.h"
#import "CMTextView.h"
-#include <tgmath.h>
+#import "SPConstants.h"
@interface NSTableView (MovingSelectedRow)
@@ -556,7 +557,7 @@
NSPoint old = NSMakePoint([self frame].origin.x, [self frame].origin.y + [self frame].size.height);
- NSInteger displayedRows = [newFiltered count] < SP_NARROWDOWNLIST_MAX_ROWS ? [newFiltered count] : SP_NARROWDOWNLIST_MAX_ROWS;
+ NSInteger displayedRows = [newFiltered count] < SPNarrowDownCompletionMaxRows ? [newFiltered count] : SPNarrowDownCompletionMaxRows;
CGFloat newHeight = ([theTableView rowHeight] + [theTableView intercellSpacing].height) * ((displayedRows) ? displayedRows : 1);
if(caretPos.y >= 0 && (isAbove || caretPos.y < newHeight))
diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h
index 52ce30ef..09507464 100644
--- a/Source/SPNavigatorController.h
+++ b/Source/SPNavigatorController.h
@@ -25,9 +25,8 @@
#import <Cocoa/Cocoa.h>
#import <MCPKit/MCPKit.h>
-
-@interface SPNavigatorController : NSWindowController {
-
+@interface SPNavigatorController : NSWindowController
+{
IBOutlet id outlineSchema1;
IBOutlet id outlineSchema2;
IBOutlet id navigatorWindow;
@@ -53,7 +52,6 @@
NSRect selectionViewPort1;
NSRect selectionViewPort2;
BOOL ignoreUpdate;
-
}
+ (SPNavigatorController *)sharedNavigatorController;
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 46780402..6295058c 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -33,14 +33,12 @@
#import "SPLogger.h"
#import "SPTooltip.h"
-
static SPNavigatorController *sharedNavigatorController = nil;
#define DragFromNavigatorPboardType @"SPDragFromNavigatorPboardType"
@implementation SPNavigatorController
-
/*
* Returns the shared query console.
*/
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index d7d6bdbe..e365f296 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -31,8 +31,6 @@
#import "SPConnectionController.h"
#import "SPConstants.h"
-#pragma mark -
-
@interface SPPreferenceController (PrivateAPI)
- (void)_setupToolbar;
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index eba1f753..198e154d 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -30,10 +30,6 @@
#import "CustomQuery.h"
#define MESSAGE_TRUNCATE_CHARACTER_LENGTH 256
-#define MESSAGE_TIME_STAMP_FORMAT @"%H:%M:%S"
-
-#define DEFAULT_CONSOLE_LOG_FILENAME @"untitled"
-#define CONSOLE_WINDOW_AUTO_SAVE_NAME @"QueryConsole"
// Table view column identifiers
#define TABLEVIEW_MESSAGE_COLUMN_IDENTIFIER @"message"
@@ -162,7 +158,7 @@ static SPQueryController *sharedQueryController = nil;
{
prefs = [NSUserDefaults standardUserDefaults];
- [self setWindowFrameAutosaveName:CONSOLE_WINDOW_AUTO_SAVE_NAME];
+ [self setWindowFrameAutosaveName:@"QueryConsole"];
// Show/hide table columns
[[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] setHidden:![prefs boolForKey:SPConsoleShowTimestamps]];
@@ -278,7 +274,7 @@ static SPQueryController *sharedQueryController = nil;
[panel setAccessoryView:saveLogView];
- [panel beginSheetForDirectory:nil file:DEFAULT_CONSOLE_LOG_FILENAME modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
+ [panel beginSheetForDirectory:nil file:@"untitled" modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
}
/**
@@ -374,12 +370,8 @@ static SPQueryController *sharedQueryController = nil;
id object = [[messagesVisibleSet objectAtIndex:row] valueForKey:[tableColumn identifier]];
if ([[tableColumn identifier] isEqualToString:TABLEVIEW_DATE_COLUMN_IDENTIFIER]) {
-
- //NSString *dateString = [(NSDate *)object descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil];
-
- returnValue = [dateFormatter stringFromDate:(NSDate *)object];
-
- //returnValue = dateString;
+
+ returnValue = [dateFormatter stringFromDate:(NSDate *)object];
}
else {
if ([(NSString *)object length] > MESSAGE_TRUNCATE_CHARACTER_LENGTH) {
diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h
index 836611f3..45f513ec 100644
--- a/Source/SPSSHTunnel.h
+++ b/Source/SPSSHTunnel.h
@@ -26,13 +26,6 @@
#import <Cocoa/Cocoa.h>
#import <MCPKit/MCPKit.h>
-enum spsshtunnel_password_modes
-{
- SPSSH_PASSWORD_USES_KEYCHAIN = 0,
- SPSSH_PASSWORD_ASKS_UI = 1,
- SPSSH_NO_PASSWORD = 2
-};
-
@interface SPSSHTunnel : NSObject <MCPConnectionProxy>
{
IBOutlet NSWindow *sshQuestionDialog;
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 48d17932..e6d9729a 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -286,13 +286,13 @@
[taskEnvironment setObject:tunnelConnectionName forKey:@"SP_CONNECTION_NAME"];
[taskEnvironment setObject:tunnelConnectionVerifyHash forKey:@"SP_CONNECTION_VERIFY_HASH"];
if (passwordInKeychain) {
- [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_PASSWORD_USES_KEYCHAIN] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSHPasswordUsesKeychain] stringValue] forKey:@"SP_PASSWORD_METHOD"];
[taskEnvironment setObject:keychainName forKey:@"SP_KEYCHAIN_ITEM_NAME"];
[taskEnvironment setObject:keychainAccount forKey:@"SP_KEYCHAIN_ITEM_ACCOUNT"];
} else if (password) {
- [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_PASSWORD_ASKS_UI] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSHPasswordAsksUI] stringValue] forKey:@"SP_PASSWORD_METHOD"];
} else {
- [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_NO_PASSWORD] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSHPasswordNone] stringValue] forKey:@"SP_PASSWORD_METHOD"];
}
[task setEnvironment:taskEnvironment];
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 16f714c9..2b07fbce 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -37,7 +37,6 @@
@implementation SPTableData
-
- (id) init
{
if ((self = [super init])) {
@@ -72,7 +71,7 @@
- (NSString *) tableEncoding
{
if (tableEncoding == nil) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -87,7 +86,7 @@
- (NSString *) tableCreateSyntax
{
if (tableCreateSyntax == nil) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
}
else {
@@ -105,7 +104,7 @@
- (NSArray *) columns
{
if ([columns count] == 0) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -130,7 +129,7 @@
- (NSDictionary *) columnWithName:(NSString *)colName
{
if ([columns count] == 0) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -148,7 +147,7 @@
- (NSArray *) columnNames
{
if ([columnNames count] == 0) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -164,7 +163,7 @@
- (NSDictionary *) columnAtIndex:(NSInteger)index
{
if ([columns count] == 0) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -181,7 +180,7 @@
- (BOOL) columnIsBlobOrText:(NSString *)colName
{
if ([columns count] == 0) {
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[self updateInformationForCurrentView];
} else {
[self updateInformationForCurrentTable];
@@ -275,7 +274,7 @@
NSDictionary *columnData;
NSEnumerator *enumerator;
- if( [tableListInstance tableType] == SP_TABLETYPE_TABLE || [tableListInstance tableType] == SP_TABLETYPE_VIEW ) {
+ if( [tableListInstance tableType] == SPTableTypeTable || [tableListInstance tableType] == SPTableTypeView ) {
tableData = [self informationForTable:[tableListInstance tableName]];
}
@@ -783,7 +782,7 @@
// When views are selected, populate the table with a default dictionary - all values, including comment, return no
// meaningful information for views so we may as well skip the query.
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[status setDictionary:[NSDictionary dictionaryWithObjectsAndKeys:@"View", @"Engine", @"No status information is available for views.", @"Comment", [tableListInstance tableName], @"Name", nil]];
return TRUE;
}
@@ -794,17 +793,17 @@
MCPResult *tableStatusResult = nil;
- if ([tableListInstance tableType] == SP_TABLETYPE_PROC) {
+ if ([tableListInstance tableType] == SPTableTypeProc) {
NSMutableString *escapedDatabaseName = [NSMutableString stringWithString:[tableDocumentInstance database]];
[escapedDatabaseName replaceOccurrencesOfString:@"'" withString:@"\\\'" options:0 range:NSMakeRange(0, [escapedDatabaseName length])];
tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM information_schema.ROUTINES AS r WHERE r.SPECIFIC_NAME = '%@' AND r.ROUTINE_SCHEMA = '%@' AND r.ROUTINE_TYPE = 'PROCEDURE'", escapedTableName, escapedDatabaseName]];
}
- else if ([tableListInstance tableType] == SP_TABLETYPE_FUNC) {
+ else if ([tableListInstance tableType] == SPTableTypeFunc) {
NSMutableString *escapedDatabaseName = [NSMutableString stringWithString:[tableDocumentInstance database]];
[escapedDatabaseName replaceOccurrencesOfString:@"'" withString:@"\\\'" options:0 range:NSMakeRange(0, [escapedDatabaseName length])];
tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM information_schema.ROUTINES AS r WHERE r.SPECIFIC_NAME = '%@' AND r.ROUTINE_SCHEMA = '%@' AND r.ROUTINE_TYPE = 'FUNCTION'", escapedTableName, escapedDatabaseName]];
}
- else if ([tableListInstance tableType] == SP_TABLETYPE_TABLE) {
+ else if ([tableListInstance tableType] == SPTableTypeTable) {
tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", escapedTableName ]];
[tableStatusResult setReturnDataAsStrings:YES];
}
@@ -823,7 +822,7 @@
// Retrieve the status as a dictionary and set as the cache
[status setDictionary:[tableStatusResult fetchRowAsDictionary]];
- if ([tableListInstance tableType] == SP_TABLETYPE_TABLE) {
+ if ([tableListInstance tableType] == SPTableTypeTable) {
// Reassign any "Type" key - for MySQL < 4.1 - to "Engine" for consistency.
if ([status objectForKey:@"Type"]) {
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index dc7d216d..5e01d987 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -78,7 +78,7 @@
[info removeAllObjects];
// For views, no information can be displayed.
- if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
+ if ([tableListInstance tableType] == SPTableTypeView) {
[info addObject:NSLocalizedString(@"VIEW INFORMATION", @"header for view info pane")];
[info addObject:NSLocalizedString(@"no information available", @"no information available")];
[infoTable reloadData];
@@ -93,7 +93,7 @@
}
// Get TABLE information
- if ([tableListInstance tableType] == SP_TABLETYPE_TABLE) {
+ if ([tableListInstance tableType] == SPTableTypeTable) {
[info addObject:NSLocalizedString(@"TABLE INFORMATION", @"header for table info pane")];
@@ -140,9 +140,9 @@
}
// Get PROC/FUNC information
- else if ([tableListInstance tableType] == SP_TABLETYPE_PROC || [tableListInstance tableType] == SP_TABLETYPE_FUNC) {
+ else if ([tableListInstance tableType] == SPTableTypeProc || [tableListInstance tableType] == SPTableTypeFunc) {
- if ([tableListInstance tableType] == SP_TABLETYPE_PROC)
+ if ([tableListInstance tableType] == SPTableTypeProc)
[info addObject:NSLocalizedString(@"PROCEDURE INFORMATION", @"header for procedure info pane")];
else
[info addObject:NSLocalizedString(@"FUNCTION INFORMATION", @"header for function info pane")];
@@ -178,7 +178,7 @@
}
// Check for 'DTD_IDENTIFIER' for FUNCTIONS only
- if ([tableListInstance tableType] == SP_TABLETYPE_FUNC) {
+ if ([tableListInstance tableType] == SPTableTypeFunc) {
if (![[tableStatus objectForKey:@"DTD_IDENTIFIER"] isNSNull]) {
[info addObject:[NSString stringWithFormat:NSLocalizedString(@"return type: %@", @"return type: %@"), [tableStatus objectForKey:@"DTD_IDENTIFIER"]]];
}
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 0788f832..3f79dbe7 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -244,7 +244,7 @@
// Get the current table's storage engine
NSString *engine = [tableDataInstance statusValueForKey:@"Engine"];
- if (([tablesListInstance tableType] == SP_TABLETYPE_TABLE) && ([[engine lowercaseString] isEqualToString:@"innodb"])) {
+ if (([tablesListInstance tableType] == SPTableTypeTable) && ([[engine lowercaseString] isEqualToString:@"innodb"])) {
// Update the text label
[labelTextField setStringValue:[NSString stringWithFormat:@"Relations for table: %@", [tablesListInstance tableName]]];
@@ -258,7 +258,7 @@
[refreshRelationsButton setEnabled:NO];
[relationsTableView setEnabled:NO];
- [labelTextField setStringValue:([tablesListInstance tableType] == SP_TABLETYPE_TABLE) ? @"This table currently does not support relations. Only tables that use the InnoDB storage engine support them." : @""];
+ [labelTextField setStringValue:([tablesListInstance tableType] == SPTableTypeTable) ? @"This table currently does not support relations. Only tables that use the InnoDB storage engine support them." : @""];
}
[self _refreshRelationDataForcingCacheRefresh:NO];
@@ -487,7 +487,7 @@
{
[relationData removeAllObjects];
- if ([tablesListInstance tableType] == SP_TABLETYPE_TABLE) {
+ if ([tablesListInstance tableType] == SPTableTypeTable) {
if (clearAllCaches) [tableDataInstance updateInformationForCurrentTable];
diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m
index e9283124..78c9ba52 100644
--- a/Source/SPTableTriggers.m
+++ b/Source/SPTableTriggers.m
@@ -471,7 +471,7 @@
{
[triggerData removeAllObjects];
- if ([tablesListInstance tableType] == SP_TABLETYPE_TABLE) {
+ if ([tablesListInstance tableType] == SPTableTypeTable) {
if (clearAllCaches) [tableDataInstance updateInformationForCurrentTable];
diff --git a/Source/SequelProTunnelAssistant.m b/Source/SequelProTunnelAssistant.m
index b8d96ec5..e6b78b81 100644
--- a/Source/SequelProTunnelAssistant.m
+++ b/Source/SequelProTunnelAssistant.m
@@ -23,8 +23,10 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <Cocoa/Cocoa.h>
+
#import "SPKeychain.h"
#import "SPSSHTunnel.h"
+#import "SPConstants.h"
#import "RegexKitLite.h"
int main(int argc, const char *argv[])
@@ -68,7 +70,7 @@ int main(int argc, const char *argv[])
// If the password method is set to use the keychain, use the supplied keychain name to
// request the password
- if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSH_PASSWORD_USES_KEYCHAIN) {
+ if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSHPasswordUsesKeychain) {
SPKeychain *keychain;
NSString *keychainName = [environment objectForKey:@"SP_KEYCHAIN_ITEM_NAME"];
NSString *keychainAccount = [environment objectForKey:@"SP_KEYCHAIN_ITEM_ACCOUNT"];
@@ -94,7 +96,7 @@ int main(int argc, const char *argv[])
}
// If the password method is set to request the password from the tunnel instance, do so.
- if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSH_PASSWORD_ASKS_UI) {
+ if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSHPasswordAsksUI) {
NSString *password;
if (!connectionName || !verificationHash) {
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 06f5f744..7e51de3c 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -54,6 +54,7 @@
#import "SPProcessListController.h"
#import "SPServerVariablesController.h"
#import "SPAlertSheets.h"
+#import "SPConstants.h"
#import "SPMainThreadTrampoline.h"
@interface TableDocument (PrivateAPI)
@@ -1630,20 +1631,20 @@
NSString *query = nil;
NSString *typeString = @"";
- if( [tablesListInstance tableType] == SP_TABLETYPE_TABLE ) {
+ if( [tablesListInstance tableType] == SPTableTypeTable ) {
query = [NSString stringWithFormat:@"SHOW CREATE TABLE %@", [[self table] backtickQuotedString]];
typeString = @"table";
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_VIEW ) {
+ else if( [tablesListInstance tableType] == SPTableTypeView ) {
query = [NSString stringWithFormat:@"SHOW CREATE VIEW %@", [[self table] backtickQuotedString]];
typeString = @"view";
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_PROC ) {
+ else if( [tablesListInstance tableType] == SPTableTypeProc ) {
query = [NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [[self table] backtickQuotedString]];
typeString = @"procedure";
colOffs = 2;
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_FUNC ) {
+ else if( [tablesListInstance tableType] == SPTableTypeFunc ) {
query = [NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [[self table] backtickQuotedString]];
typeString = @"function";
colOffs = 2;
@@ -1669,7 +1670,7 @@
[createTableSyntaxTextView setEditable:YES];
[createTableSyntaxTextView setString:@""];
- [createTableSyntaxTextView insertText:([tablesListInstance tableType] == SP_TABLETYPE_VIEW) ? [tableSyntax createViewSyntaxPrettifier] : tableSyntax];
+ [createTableSyntaxTextView insertText:([tablesListInstance tableType] == SPTableTypeView) ? [tableSyntax createViewSyntaxPrettifier] : tableSyntax];
[createTableSyntaxTextView setEditable:NO];
[createTableSyntaxWindow makeFirstResponder:createTableSyntaxTextField];
@@ -1692,17 +1693,17 @@
NSString *query = nil;
NSInteger colOffs = 1;
- if( [tablesListInstance tableType] == SP_TABLETYPE_TABLE ) {
+ if( [tablesListInstance tableType] == SPTableTypeTable ) {
query = [NSString stringWithFormat:@"SHOW CREATE TABLE %@", [[self table] backtickQuotedString]];
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_VIEW ) {
+ else if( [tablesListInstance tableType] == SPTableTypeView ) {
query = [NSString stringWithFormat:@"SHOW CREATE VIEW %@", [[self table] backtickQuotedString]];
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_PROC ) {
+ else if( [tablesListInstance tableType] == SPTableTypeProc ) {
query = [NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [[self table] backtickQuotedString]];
colOffs = 2;
}
- else if( [tablesListInstance tableType] == SP_TABLETYPE_FUNC ) {
+ else if( [tablesListInstance tableType] == SPTableTypeFunc ) {
query = [NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [[self table] backtickQuotedString]];
colOffs = 2;
}
@@ -1726,7 +1727,7 @@
// copy to the clipboard
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];
- if([tablesListInstance tableType] == SP_TABLETYPE_VIEW)
+ if([tablesListInstance tableType] == SPTableTypeView)
[pb setString:[tableSyntax createViewSyntaxPrettifier] forType:NSStringPboardType];
else
[pb setString:tableSyntax forType:NSStringPboardType];
@@ -2878,19 +2879,19 @@
[session setObject:[tableContentInstance sortColumnName] forKey:@"contentSortCol"];
switch([spHistoryControllerInstance currentlySelectedView]){
- case SP_VIEW_STRUCTURE:
+ case SPHistoryViewStructure:
aString = @"SP_VIEW_STRUCTURE";
break;
- case SP_VIEW_CONTENT:
+ case SPHistoryViewContent:
aString = @"SP_VIEW_CONTENT";
break;
- case SP_VIEW_CUSTOMQUERY:
+ case SPHistoryViewCustomQuery:
aString = @"SP_VIEW_CUSTOMQUERY";
break;
- case SP_VIEW_STATUS:
+ case SPHistoryViewStatus:
aString = @"SP_VIEW_STATUS";
break;
- case SP_VIEW_RELATIONS:
+ case SPHistoryViewRelations:
aString = @"SP_VIEW_RELATIONS";
break;
default:
@@ -3611,8 +3612,8 @@
}
if (![identifier isEqualToString:SPMainToolbarCustomQuery] && ![identifier isEqualToString:SPMainToolbarUserManager]) {
- return (([tablesListInstance tableType] == SP_TABLETYPE_TABLE) ||
- ([tablesListInstance tableType] == SP_TABLETYPE_VIEW));
+ return (([tablesListInstance tableType] == SPTableTypeTable) ||
+ ([tablesListInstance tableType] == SPTableTypeView));
}
return YES;
diff --git a/Source/TableDump.h b/Source/TableDump.h
index dc5af40f..6a6a34b0 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -25,15 +25,9 @@
// Or mail to <lorenz@textor.ch>
#import <Cocoa/Cocoa.h>
-#import "SPFieldMapperController.h"
#import <MCPKit/MCPKit.h>
-typedef enum _SPExportModes {
- SPExportingSQL = 0,
- SPExportingCSV = 1,
- SPExportingXML = 2,
- SPExportingDOT = 3
-} SPExportMode;
+@class SPFieldMapperController;
@interface TableDump : NSObject
{
@@ -123,7 +117,6 @@ typedef enum _SPExportModes {
NSUInteger exportMode;
NSUserDefaults *prefs;
BOOL progressCancelled;
-
}
// IBAction methods
diff --git a/Source/TableDump.m b/Source/TableDump.m
index db26db5a..26ed5e48 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -65,18 +65,18 @@
// For all modes, retrieve table and view names
NSArray *tablesAndViews = [tablesListInstance allTableAndViewNames];
for (id itemName in tablesAndViews) {
- [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], itemName, [NSNumber numberWithInt:SP_TABLETYPE_TABLE], nil]];
+ [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], itemName, [NSNumber numberWithInt:SPTableTypeTable], nil]];
}
// For SQL only, add procedures and functions
if (exportMode == SPExportingSQL) {
NSArray *procedures = [tablesListInstance allProcedureNames];
for (id procName in procedures) {
- [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], procName, [NSNumber numberWithInt:SP_TABLETYPE_PROC], nil]];
+ [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], procName, [NSNumber numberWithInt:SPTableTypeProc], nil]];
}
NSArray *functions = [tablesListInstance allFunctionNames];
for (id funcName in functions) {
- [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], funcName, [NSNumber numberWithInt:SP_TABLETYPE_FUNC], nil]];
+ [tables addObject:[NSMutableArray arrayWithObjects:[NSNumber numberWithBool:YES], funcName, [NSNumber numberWithInt:SPTableTypeFunc], nil]];
}
}
@@ -1446,7 +1446,7 @@
{
NSInteger i,j,t,rowCount, colCount, lastProgressValue, queryLength;
NSInteger progressBarWidth;
- NSInteger tableType = SP_TABLETYPE_TABLE; //real tableType will be setup later
+ NSInteger tableType = SPTableTypeTable; //real tableType will be setup later
MCPResult *queryResult;
MCPStreamingResult *streamingResult;
NSAutoreleasePool *exportAutoReleasePool = nil;
@@ -1489,10 +1489,10 @@
for ( i = 0 ; i < [tables count] ; i++ ) {
if ( [NSArrayObjectAtIndex(NSArrayObjectAtIndex(tables, i), 0) boolValue] ) {
switch ([NSArrayObjectAtIndex(NSArrayObjectAtIndex(tables, i), 2) intValue]) {
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
targetArray = selectedProcs;
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
targetArray = selectedFuncs;
break;
default:
@@ -1567,10 +1567,10 @@
if ([tableDetails objectForKey:@"Create View"]) {
[viewSyntaxes setValue:[[[[tableDetails objectForKey:@"Create View"] copy] autorelease] createViewSyntaxPrettifier] forKey:tableName];
createTableSyntax = [self createViewPlaceholderSyntaxForView:tableName];
- tableType = SP_TABLETYPE_VIEW;
+ tableType = SPTableTypeView;
} else {
createTableSyntax = [[[tableDetails objectForKey:@"Create Table"] copy] autorelease];
- tableType = SP_TABLETYPE_TABLE;
+ tableType = SPTableTypeTable;
}
[tableDetails release];
}
@@ -1584,7 +1584,7 @@
// Add a "drop table" command if specified in the export dialog
if ( [addDropTableSwitch state] == NSOnState )
- [fileHandle writeData:[[NSString stringWithFormat:@"DROP %@ IF EXISTS %@;\n\n", ((tableType == SP_TABLETYPE_TABLE)?@"TABLE":@"VIEW"), [tableName backtickQuotedString]]
+ [fileHandle writeData:[[NSString stringWithFormat:@"DROP %@ IF EXISTS %@;\n\n", ((tableType == SPTableTypeTable)?@"TABLE":@"VIEW"), [tableName backtickQuotedString]]
dataUsingEncoding:NSUTF8StringEncoding]];
@@ -1598,7 +1598,7 @@
}
// Add the table content if required
- if ( [addTableContentSwitch state] == NSOnState && tableType == SP_TABLETYPE_TABLE ) {
+ if ( [addTableContentSwitch state] == NSOnState && tableType == SPTableTypeTable ) {
// Retrieve the table details via the data class, and use it to build an array containing column numeric status
tableDetails = [NSDictionary dictionaryWithDictionary:[tableDataInstance informationForTable:tableName]];
diff --git a/Source/TableSource.m b/Source/TableSource.m
index fa0e190d..38a6b16d 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -45,9 +45,9 @@
@implementation TableSource
-/*
-loads aTable, put it in an array, update the tableViewColumns and reload the tableView
-*/
+/**
+ * Loads aTable, put it in an array, update the tableViewColumns and reload the tableView
+ */
- (void)loadTable:(NSString *)aTable
{
NSArray *theTableFields, *theTableIndexes;
@@ -265,7 +265,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
[editTableButton setEnabled:enableInteraction];
// If a view is selected, disable the buttons; otherwise enable.
- BOOL editingEnabled = ([tablesListInstance tableType] == SP_TABLETYPE_TABLE) && enableInteraction;
+ BOOL editingEnabled = ([tablesListInstance tableType] == SPTableTypeTable) && enableInteraction;
[addFieldButton setEnabled:editingEnabled];
[addIndexButton setEnabled:editingEnabled];
@@ -1241,7 +1241,7 @@ returns a dictionary containing enum/set field names as key and possible values
// Only re-enable elements if the current tab is the structure view
if (![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableStructure]) return;
- BOOL editingEnabled = ([tablesListInstance tableType] == SP_TABLETYPE_TABLE);
+ BOOL editingEnabled = ([tablesListInstance tableType] == SPTableTypeTable);
[tableSourceView setEnabled:YES];
[tableSourceView displayIfNeeded];
[addFieldButton setEnabled:editingEnabled];
@@ -1307,7 +1307,7 @@ returns a dictionary containing enum/set field names as key and possible values
if ([tableDocumentInstance isWorking]) return NO;
// Return NO for views
- if ([tablesListInstance tableType] == SP_TABLETYPE_VIEW) return NO;
+ if ([tablesListInstance tableType] == SPTableTypeView) return NO;
return YES;
}
@@ -1484,7 +1484,7 @@ would result in a position change.
[copyFieldButton setEnabled:YES];
// Check if there is currently a field selected and change button state accordingly
- if ([tableSourceView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SP_TABLETYPE_TABLE) {
+ if ([tableSourceView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable) {
[removeFieldButton setEnabled:YES];
} else {
[removeFieldButton setEnabled:NO];
@@ -1499,7 +1499,7 @@ would result in a position change.
}
else if (object == indexView) {
// Check if there is currently an index selected and change button state accordingly
- [removeIndexButton setEnabled:([indexView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SP_TABLETYPE_TABLE)];
+ [removeIndexButton setEnabled:([indexView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable)];
}
}
@@ -1567,7 +1567,7 @@ would result in a position change.
//make sure that the message is from the right table view
if (tableView!=tableSourceView) return;
- [aCell setEnabled:([tablesListInstance tableType] == SP_TABLETYPE_TABLE)];
+ [aCell setEnabled:([tablesListInstance tableType] == SPTableTypeTable)];
}
#pragma mark -
diff --git a/Source/TablesList.h b/Source/TablesList.h
index 509ac96f..5abbddad 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -27,15 +27,6 @@
#import <MCPKit/MCPKit.h>
#import "SPHistoryController.h"
-enum sp_table_types
-{
- SP_TABLETYPE_NONE = -1,
- SP_TABLETYPE_TABLE = 0,
- SP_TABLETYPE_VIEW = 1,
- SP_TABLETYPE_PROC = 2,
- SP_TABLETYPE_FUNC = 3
-};
-
@interface NSObject (NSSplitView)
- (NSView *)collapsibleSubview;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 67fb8f04..21ea8078 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -48,9 +48,9 @@
- (void)truncateTable;
- (void)addTable;
- (void)copyTable;
-- (void)renameTableOfType: (enum sp_table_types)tableType from:(NSString *)oldTableName to:(NSString *)newTableName;
-- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType;
-- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
+- (void)renameTableOfType:(SPTableType)tableType from:(NSString *)oldTableName to:(NSString *)newTableName;
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType;
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
@end
@@ -101,17 +101,17 @@
if ([theResult numOfFields] == 1) {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
[tables addObject:[[theResult fetchRowAsArray] objectAtIndex:0]];
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeTable]];
}
} else {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
resultRow = [theResult fetchRowAsArray];
[tables addObject:[resultRow objectAtIndex:0]];
if ([[resultRow objectAtIndex:1] isEqualToString:@"VIEW"]) {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_VIEW]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeView]];
tableListContainsViews = YES;
} else {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeTable]];
}
}
}
@@ -133,16 +133,16 @@
if([[mySQLConnection getLastErrorMessage] isEqualToString:@""] && theResult != nil && [theResult numOfRows] ) {
// add the header row
[tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]];
[theResult dataSeek:0];
if( [theResult numOfFields] == 1 ) {
for( i = 0; i < [theResult numOfRows]; i++ ) {
[tables addObject:NSArrayObjectAtIndex([theResult fetchRowAsArray],3)];
if( [NSArrayObjectAtIndex([theResult fetchRowAsArray], 4) isEqualToString:@"PROCEDURE"]) {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeProc]];
} else {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeFunc]];
}
}
} else {
@@ -150,9 +150,9 @@
resultRow = [theResult fetchRowAsArray];
[tables addObject:NSArrayObjectAtIndex(resultRow, 3)];
if( [NSArrayObjectAtIndex(resultRow, 4) isEqualToString:@"PROCEDURE"] ) {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeProc]];
} else {
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeFunc]];
}
}
}
@@ -166,20 +166,20 @@
if( [theResult numOfRows] ) {
// add the header row
[tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeNone]];
addedPFHeader = TRUE;
[theResult dataSeek:0];
if( [theResult numOfFields] == 1 ) {
for( i = 0; i < [theResult numOfRows]; i++ ) {
[tables addObject:[[theResult fetchRowAsArray] objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeProc]];
}
} else {
for( i = 0; i < [theResult numOfRows]; i++ ) {
resultRow = [theResult fetchRowAsArray];
[tables addObject:[resultRow objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeProc]];
}
}
}
@@ -191,20 +191,20 @@
if( !addedPFHeader ) {
// add the header row
[tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeNone]];
}
[theResult dataSeek:0];
if( [theResult numOfFields] == 1 ) {
for( i = 0; i < [theResult numOfRows]; i++ ) {
[tables addObject:[[theResult fetchRowAsArray] objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeFunc]];
}
} else {
for( i = 0; i < [theResult numOfRows]; i++ ) {
resultRow = [theResult fetchRowAsArray];
[tables addObject:[resultRow objectAtIndex:1]];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInt:SPTableTypeFunc]];
}
}
}
@@ -219,7 +219,7 @@
} else {
[tables insertObject:NSLocalizedString(@"TABLES",@"header for table list") atIndex:0];
}
- [tableTypes insertObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE] atIndex:0];
+ [tableTypes insertObject:[NSNumber numberWithInteger:SPTableTypeNone] atIndex:0];
[[tablesListView onMainThread] reloadData];
@@ -238,7 +238,7 @@
} else {
if (selectedTableName) [selectedTableName release];
selectedTableName = nil;
- selectedTableType = SP_TABLETYPE_NONE;
+ selectedTableType = SPTableTypeNone;
}
// Determine whether or not to show the list filter based on the number of tables, and clear it
@@ -322,13 +322,13 @@
NSUInteger currentIndex = [indexes lastIndex];
if ([tablesListView numberOfSelectedRows] == 1) {
- if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_VIEW)
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeView)
tblTypes = NSLocalizedString(@"view", @"view");
- else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_TABLE)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeTable)
tblTypes = NSLocalizedString(@"table", @"table");
- else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_PROC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeProc)
tblTypes = NSLocalizedString(@"procedure", @"procedure");
- else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_FUNC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeFunc)
tblTypes = NSLocalizedString(@"function", @"function");
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete %@ '%@'?", @"delete table/view message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
@@ -350,16 +350,16 @@
if(areTableTypeEqual)
{
switch(lastType) {
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeTable:
tblTypes = NSLocalizedString(@"tables", @"tables");
break;
- case SP_TABLETYPE_VIEW:
+ case SPTableTypeView:
tblTypes = NSLocalizedString(@"views", @"views");
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
tblTypes = NSLocalizedString(@"procedures", @"procedures");
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
tblTypes = NSLocalizedString(@"functions", @"functions");
break;
}
@@ -390,19 +390,19 @@
NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
switch (tblType){
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeTable:
tableType = NSLocalizedString(@"table",@"table");
[copyTableContentSwitch setEnabled:YES];
break;
- case SP_TABLETYPE_VIEW:
+ case SPTableTypeView:
tableType = NSLocalizedString(@"view",@"view");
[copyTableContentSwitch setEnabled:NO];
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
tableType = NSLocalizedString(@"procedure",@"procedure");
[copyTableContentSwitch setEnabled:NO];
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
tableType = NSLocalizedString(@"function",@"function");
[copyTableContentSwitch setEnabled:NO];
break;
@@ -445,16 +445,16 @@
NSString *tableType;
switch([self tableType]){
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeTable:
tableType = NSLocalizedString(@"table",@"table");
break;
- case SP_TABLETYPE_VIEW:
+ case SPTableTypeView:
tableType = NSLocalizedString(@"view",@"view");
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
tableType = NSLocalizedString(@"procedure",@"procedure");
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
tableType = NSLocalizedString(@"function",@"function");
break;
}
@@ -585,7 +585,7 @@
id object = [notification object];
if (object == tableNameField) {
- [addTableButton setEnabled:[self isTableNameValid:[tableNameField stringValue] forType: SP_TABLETYPE_TABLE]];
+ [addTableButton setEnabled:[self isTableNameValid:[tableNameField stringValue] forType: SPTableTypeTable]];
}
else if (object == copyTableNameField) {
@@ -660,7 +660,7 @@
[self performSelectorOnMainThread:@selector(setSelection:) withObject:selectionDetails waitUntilDone:YES];
// Check the encoding if appropriate to determine if an encoding change and reset is required
- if( selectedTableType == SP_TABLETYPE_VIEW || selectedTableType == SP_TABLETYPE_TABLE) {
+ if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) {
// tableEncoding == nil indicates that there was an error while retrieving table data
tableEncoding = [tableDataInstance tableEncoding];
@@ -685,7 +685,7 @@
// Restore view states as appropriate
[spHistoryControllerInstance restoreViewStates];
- if( selectedTableType == SP_TABLETYPE_VIEW || selectedTableType == SP_TABLETYPE_TABLE) {
+ if( selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable) {
if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
[tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
@@ -753,7 +753,7 @@
} else {
selectedTableName = nil;
}
- selectedTableType = SP_TABLETYPE_NONE;
+ selectedTableType = SPTableTypeNone;
[tableSourceInstance loadTable:nil];
[tableContentInstance loadTable:nil];
@@ -780,7 +780,7 @@
if (areTableTypeEqual)
{
switch (lastType) {
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeTable:
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
[truncateTableButton setTitle:NSLocalizedString(@"Truncate Tables", @"truncate tables menu item")];
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Tables", @"remove tables menu title")];
@@ -788,19 +788,19 @@
[truncateTableButton setHidden:NO];
[truncateTableContextButton setHidden:NO];
break;
- case SP_TABLETYPE_VIEW:
+ case SPTableTypeView:
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Views", @"remove views menu title")];
[truncateTableButton setHidden:YES];
[truncateTableContextButton setHidden:YES];
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedures", @"remove procedures menu title")];
[truncateTableButton setHidden:YES];
[truncateTableContextButton setHidden:YES];
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Functions", @"remove functions menu title")];
[truncateTableButton setHidden:YES];
@@ -861,7 +861,7 @@
// Remove the "current selection" item for filtered lists if appropriate
if (isTableListFiltered && [tablesListView selectedRow] < [filteredTables count] - 2 && [filteredTables count] > 2
- && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] integerValue] == SP_TABLETYPE_NONE
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] integerValue] == SPTableTypeNone
&& [[filteredTables objectAtIndex:[filteredTables count]-2] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
{
[filteredTables removeObjectsInRange:NSMakeRange([filteredTables count]-2, 2)];
@@ -879,7 +879,7 @@
// according to the table types
NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTitle:@"Table"] submenu];
- if(selectedTableType == SP_TABLETYPE_VIEW)
+ if(selectedTableType == SPTableTypeView)
{
// Change mainMenu > Table > ... according to table type
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")];
@@ -909,7 +909,7 @@
[truncateTableContextButton setHidden:YES];
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove View", @"remove view menu title")];
}
- else if(selectedTableType == SP_TABLETYPE_TABLE) {
+ else if(selectedTableType == SPTableTypeTable) {
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")];
[[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Table Syntax", @"show create table syntax menu item")];
[[tableSubMenu itemAtIndex:5] setHidden:NO]; // divider
@@ -944,7 +944,7 @@
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Table", @"remove table menu title")];
}
- else if(selectedTableType == SP_TABLETYPE_PROC) {
+ else if(selectedTableType == SPTableTypeProc) {
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Procedure Syntax", @"copy create proc syntax menu item")];
[[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Procedure Syntax", @"show create proc syntax menu item")];
[[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider
@@ -971,7 +971,7 @@
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Procedure", @"remove proc menu title")];
}
- else if(selectedTableType == SP_TABLETYPE_FUNC) {
+ else if(selectedTableType == SPTableTypeFunc) {
[[tableSubMenu itemAtIndex:3] setTitle:NSLocalizedString(@"Copy Create Function Syntax", @"copy create func syntax menu item")];
[[tableSubMenu itemAtIndex:4] setTitle:NSLocalizedString(@"Show Create Function Syntax", @"show create func syntax menu item")];
[[tableSubMenu itemAtIndex:5] setHidden:YES]; // divider
@@ -1014,7 +1014,7 @@
NSMutableArray *selTables = [NSMutableArray array];
while (currentIndex != NSNotFound) {
- if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_TABLE)
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeTable)
[selTables addObject:[filteredTables objectAtIndex:currentIndex]];
currentIndex = [indexes indexGreaterThanIndex:currentIndex];
}
@@ -1068,7 +1068,7 @@
NSInteger i;
NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_TABLE || [NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_VIEW)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeTable || [NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeView)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1079,7 +1079,7 @@
NSInteger i;
NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_TABLE)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeTable)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1090,7 +1090,7 @@
NSInteger i;
NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_VIEW)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeView)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
[returnArray sortUsingSelector:@selector(compare:)];
@@ -1102,7 +1102,7 @@
NSInteger i;
NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_PROC)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeProc)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1113,7 +1113,7 @@
NSInteger i;
NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_FUNC)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SPTableTypeFunc)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1204,7 +1204,7 @@
// Loop through the unfiltered tables/views to find the desired item
for (i = 0; i < [tables count]; i++) {
tableType = [[tableTypes objectAtIndex:i] integerValue];
- if (tableType == SP_TABLETYPE_NONE) continue;
+ if (tableType == SPTableTypeNone) continue;
if ([[tables objectAtIndex:i] isEqualToString:theName]) {
itemIndex = i;
break;
@@ -1317,7 +1317,7 @@
selectedTableName = [[NSString alloc] initWithString:newTableName];
// if the 'table' is a view or a table, reload the currently selected view
- if (selectedTableType == SP_TABLETYPE_TABLE || selectedTableType == SP_TABLETYPE_VIEW)
+ if (selectedTableType == SPTableTypeTable || selectedTableType == SPTableTypeView)
{
switch ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]]) {
case 0:
@@ -1453,7 +1453,7 @@
//return (rowIndex != 0);
if( [filteredTableTypes count] == 0 )
return (rowIndex != 0 );
- return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] != SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] != SPTableTypeNone );
}
/**
@@ -1464,7 +1464,7 @@
// For empty tables - title still present - or while lists are being altered
if (rowIndex >= [filteredTableTypes count]) return (rowIndex == 0 );
- return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone );
}
/**
@@ -1474,17 +1474,17 @@
{
if (rowIndex > 0 && rowIndex < [filteredTableTypes count]
&& [[aTableColumn identifier] isEqualToString:@"tables"]) {
- if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_VIEW) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeView) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-view-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_TABLE) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeTable) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_PROC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeProc) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"proc-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_FUNC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeFunc) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"func-small"]];
}
- if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone) {
[(ImageAndTextCell*)aCell setImage:nil];
[(ImageAndTextCell*)aCell setIndentationLevel:0];
} else {
@@ -1526,7 +1526,7 @@
NSAutoreleasePool *tabLoadPool = [[NSAutoreleasePool alloc] init];
if ( [tablesListView numberOfSelectedRows] == 1 &&
- ([self tableType] == SP_TABLETYPE_TABLE || [self tableType] == SP_TABLETYPE_VIEW) ) {
+ ([self tableType] == SPTableTypeTable || [self tableType] == SPTableTypeView) ) {
if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded ) {
[tableSourceInstance loadTable:selectedTableName];
@@ -1636,24 +1636,24 @@
NSRange substringRange;
for (i = 0; i < [tables count]; i++) {
tableType = [[tableTypes objectAtIndex:i] integerValue];
- if (tableType == SP_TABLETYPE_NONE) continue;
+ if (tableType == SPTableTypeNone) continue;
substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch];
if (substringRange.location == NSNotFound) continue;
// Add a title if necessary
- if ((tableType == SP_TABLETYPE_TABLE || tableType == SP_TABLETYPE_VIEW) && lastTableType == NSNotFound)
+ if ((tableType == SPTableTypeTable || tableType == SPTableTypeView) && lastTableType == NSNotFound)
{
if (tableListContainsViews) {
[filteredTables addObject:NSLocalizedString(@"TABLES & VIEWS",@"header for table & views list")];
} else {
[filteredTables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
}
- [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
- } else if ((tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC)
- && (lastTableType == NSNotFound || lastTableType == SP_TABLETYPE_TABLE || lastTableType == SP_TABLETYPE_VIEW))
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]];
+ } else if ((tableType == SPTableTypeProc || tableType == SPTableTypeFunc)
+ && (lastTableType == NSNotFound || lastTableType == SPTableTypeTable || lastTableType == SPTableTypeView))
{
[filteredTables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]];
}
lastTableType = tableType;
@@ -1665,13 +1665,13 @@
// Add a "no matches" title if nothing matches the current filter settings
if (![filteredTables count]) {
[filteredTables addObject:NSLocalizedString(@"NO MATCHES",@"header for no matches in filtered list")];
- [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]];
}
// If the currently selected table isn't present in the filter list, add it as a special entry
if (selectedTableName && [filteredTables indexOfObject:selectedTableName] == NSNotFound) {
[filteredTables addObject:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")];
- [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]];
[filteredTables addObject:selectedTableName];
[filteredTableTypes addObject:[NSNumber numberWithInteger:selectedTableType]];
}
@@ -1698,7 +1698,7 @@
- (void) selectTableAtIndex:(NSNumber *)row
{
NSInteger rowIndex = [row integerValue];
- if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE)
+ if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone)
return;
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:rowIndex] byExtendingSelection:NO];
@@ -1765,7 +1765,7 @@
isTableListFiltered = NO;
tableListIsSelectable = YES;
tableListContainsViews = NO;
- selectedTableType = SP_TABLETYPE_NONE;
+ selectedTableType = SPTableTypeNone;
selectedTableName = nil;
[tables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
}
@@ -1844,19 +1844,19 @@
while (currentIndex != NSNotFound)
{
- if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_VIEW) {
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeView) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP VIEW %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_TABLE) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeTable) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP TABLE %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_PROC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeProc) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP PROCEDURE %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_FUNC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SPTableTypeFunc) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP FUNCTION %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
@@ -1905,7 +1905,7 @@
// Remove the isolated "current selection" item for filtered lists if appropriate
if (isTableListFiltered && [filteredTables count] > 1
- && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-1] integerValue] == SP_TABLETYPE_NONE
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-1] integerValue] == SPTableTypeNone
&& [[filteredTables objectAtIndex:[filteredTables count]-1] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
{
[filteredTables removeLastObject];
@@ -1993,8 +1993,8 @@
NSInteger addItemAtIndex = NSNotFound;
for (NSInteger i = 0; i < [tables count]; i++) {
NSInteger tableType = [[tableTypes objectAtIndex:i] integerValue];
- if (tableType == SP_TABLETYPE_NONE) continue;
- if (tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC) {
+ if (tableType == SPTableTypeNone) continue;
+ if (tableType == SPTableTypeProc || tableType == SPTableTypeFunc) {
addItemAtIndex = i - 1;
break;
}
@@ -2005,16 +2005,16 @@
}
if (addItemAtIndex == NSNotFound) {
[tables addObject:tableName];
- [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeTable]];
} else {
[tables insertObject:tableName atIndex:addItemAtIndex];
- [tableTypes insertObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE] atIndex:addItemAtIndex];
+ [tableTypes insertObject:[NSNumber numberWithInteger:SPTableTypeTable] atIndex:addItemAtIndex];
}
// Set the selected table name and type, and then use updateFilter and updateSelection to update the filter list and selection.
if (selectedTableName) [selectedTableName release];
selectedTableName = [[NSString alloc] initWithString:tableName];
- selectedTableType = SP_TABLETYPE_TABLE;
+ selectedTableType = SPTableTypeTable;
[self updateFilter:self];
[tablesListView scrollRowToVisible:[tablesListView selectedRow]];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), selectedTableName]];
@@ -2056,19 +2056,19 @@
NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
switch (tblType){
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeTable:
tableType = NSLocalizedString(@"table",@"table");
[copyTableContentSwitch setEnabled:YES];
break;
- case SP_TABLETYPE_VIEW:
+ case SPTableTypeView:
tableType = NSLocalizedString(@"view",@"view");
[copyTableContentSwitch setEnabled:NO];
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
tableType = NSLocalizedString(@"procedure",@"procedure");
[copyTableContentSwitch setEnabled:NO];
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
tableType = NSLocalizedString(@"function",@"function");
[copyTableContentSwitch setEnabled:NO];
break;
@@ -2091,14 +2091,14 @@
NSScanner *scanner;
NSString *scanString;
- if(tblType == SP_TABLETYPE_VIEW){
+ if(tblType == SPTableTypeView){
scanner = [[NSScanner alloc] initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create View"]];
[scanner scanUpToString:@"AS" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
[scanner release];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE VIEW %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
}
- else if(tblType == SP_TABLETYPE_TABLE){
+ else if(tblType == SPTableTypeTable){
scanner = [[NSScanner alloc] initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
[scanner scanUpToString:@"(" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
@@ -2115,13 +2115,13 @@
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
}
- else if(tblType == SP_TABLETYPE_FUNC || tblType == SP_TABLETYPE_PROC)
+ else if(tblType == SPTableTypeFunc || tblType == SPTableTypeProc)
{
// get the create syntax
MCPResult *theResult;
- if(selectedTableType == SP_TABLETYPE_PROC)
+ if(selectedTableType == SPTableTypeProc)
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE PROCEDURE %@", [selectedTableName backtickQuotedString]]];
- else if([self tableType] == SP_TABLETYPE_FUNC)
+ else if([self tableType] == SPTableTypeFunc)
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE FUNCTION %@", [selectedTableName backtickQuotedString]]];
else
return;
@@ -2182,13 +2182,13 @@
NSInteger addItemAtIndex = NSNotFound;
for (NSInteger i = 0; i < [tables count]; i++) {
NSInteger theTableType = [[tableTypes objectAtIndex:i] integerValue];
- if (theTableType == SP_TABLETYPE_NONE) continue;
- if ((theTableType == SP_TABLETYPE_VIEW || theTableType == SP_TABLETYPE_TABLE)
- && (tblType == SP_TABLETYPE_PROC || tblType == SP_TABLETYPE_FUNC)) {
+ if (theTableType == SPTableTypeNone) continue;
+ if ((theTableType == SPTableTypeView || theTableType == SPTableTypeTable)
+ && (tblType == SPTableTypeProc || tblType == SPTableTypeFunc)) {
continue;
}
- if ((theTableType == SP_TABLETYPE_PROC || theTableType == SP_TABLETYPE_FUNC)
- && (tblType == SP_TABLETYPE_VIEW || tblType == SP_TABLETYPE_TABLE)) {
+ if ((theTableType == SPTableTypeProc || theTableType == SPTableTypeFunc)
+ && (tblType == SPTableTypeView || tblType == SPTableTypeTable)) {
addItemAtIndex = i - 1;
break;
}
@@ -2225,7 +2225,7 @@
* This function ONLY changes the database. It does NOT refresh the views etc.
* CAREFUL: This function raises an exception if renaming fails, and does not show an error message.
*/
-- (void)renameTableOfType: (enum sp_table_types)tableType from:(NSString *)oldTableName to:(NSString *)newTableName
+- (void)renameTableOfType:(SPTableType)tableType from:(NSString *)oldTableName to:(NSString *)newTableName
{
// check if the name really changed
if ([oldTableName isEqualToString:newTableName]) return;
@@ -2252,7 +2252,7 @@
}
//check if we are trying to rename a TABLE or a VIEW
- if (tableType == SP_TABLETYPE_VIEW || tableType == SP_TABLETYPE_TABLE) {
+ if (tableType == SPTableTypeView || tableType == SPTableTypeTable) {
// we can use the rename table statement
[mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE %@ TO %@", [oldTableName backtickQuotedString], [newTableName backtickQuotedString]]];
// check for errors
@@ -2263,15 +2263,15 @@
}
//check if we are trying to rename a PROCEDURE or a FUNCTION
- if (tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC) {
+ if (tableType == SPTableTypeProc || tableType == SPTableTypeFunc) {
// procedures and functions can only be renamed if one creates a new one and deletes the old one
// first get the create syntax
NSString *stringTableType = @"";
switch (tableType){
- case SP_TABLETYPE_PROC: stringTableType = @"PROCEDURE"; break;
- case SP_TABLETYPE_FUNC: stringTableType = @"FUNCTION"; break;
+ case SPTableTypeProc: stringTableType = @"PROCEDURE"; break;
+ case SPTableTypeFunc: stringTableType = @"FUNCTION"; break;
}
MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE %@ %@", stringTableType, [oldTableName backtickQuotedString] ] ];
@@ -2309,12 +2309,12 @@
* Check tableName for length and if the tableName doesn't match
* against current database table/view names (case-insensitive).
*/
-- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType
{
return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO];
}
-- (BOOL)isTableNameValid:(NSString *)tableName forType: (enum sp_table_types)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable
{
BOOL isValid = YES;
@@ -2331,14 +2331,14 @@
NSArray *similarTables;
switch (tableType) {
- case SP_TABLETYPE_VIEW:
- case SP_TABLETYPE_TABLE:
+ case SPTableTypeView:
+ case SPTableTypeTable:
similarTables = [self allTableAndViewNames];
break;
- case SP_TABLETYPE_PROC:
+ case SPTableTypeProc:
similarTables = [self allProcedureNames];
break;
- case SP_TABLETYPE_FUNC:
+ case SPTableTypeFunc:
similarTables = [self allFunctionNames];
break;
default: