aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/NSNotificationAdditions.h9
-rw-r--r--Source/NSNotificationAdditions.m60
-rw-r--r--Source/SPConnectionController.m2
-rw-r--r--Source/SPConstants.m6
-rw-r--r--Source/SPCopyTable.h2
-rw-r--r--Source/SPCopyTable.m10
-rw-r--r--Source/SPCustomQuery.h2
-rw-r--r--Source/SPCustomQuery.m62
-rw-r--r--Source/SPDatabaseDocument.h4
-rw-r--r--Source/SPDatabaseDocument.m25
-rw-r--r--Source/SPDatabaseViewController.m16
-rw-r--r--Source/SPFieldEditorController.h2
-rw-r--r--Source/SPFieldEditorController.m45
-rw-r--r--Source/SPFieldMapperController.h2
-rw-r--r--Source/SPFieldMapperController.m28
-rw-r--r--Source/SPNarrowDownCompletion.m2
-rw-r--r--Source/SPQueryController.m2
-rw-r--r--Source/SPTableContent.h2
-rw-r--r--Source/SPTableContent.m243
-rw-r--r--Source/SPTableStructure.h2
-rw-r--r--Source/SPTableStructure.m40
-rw-r--r--Source/SPTableStructureDelegate.m8
-rw-r--r--Source/SPTablesList.m8
-rw-r--r--Source/SPTextView.m10
-rw-r--r--Source/SPTextViewAdditions.m13
25 files changed, 242 insertions, 363 deletions
diff --git a/Source/NSNotificationAdditions.h b/Source/NSNotificationAdditions.h
index d1903da5..8722ed4f 100644
--- a/Source/NSNotificationAdditions.h
+++ b/Source/NSNotificationAdditions.h
@@ -25,11 +25,20 @@
@interface NSNotificationCenter (NSNotificationCenterAdditions)
+#ifndef SP_REFACTOR
- (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;
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification;
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait;
+
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object;
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo;
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait;
+#endif
@end
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m
index ae949347..8b64c1f2 100644
--- a/Source/NSNotificationAdditions.m
+++ b/Source/NSNotificationAdditions.m
@@ -27,42 +27,84 @@
#import "pthread.h"
@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification;
+ (void)_postNotificationName:(NSDictionary *)info;
+ (void)_postNotificationForwarder:(NSDictionary *)info;
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification;
++ (void)_sequelProPostNotificationName:(NSDictionary *)info;
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info;
+#endif
@end
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThread:notification waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThread:notification waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
-
+
+#ifndef SP_REFACTOR
[self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#else
+ [self performSelectorOnMainThread:@selector(_sequelProPostNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#endif
{
if(pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
@@ -72,7 +114,11 @@
if (object) [info setObject:object forKey:@"object"];
if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
+#ifndef SP_REFACTOR
[[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#else
+ [[self class] performSelectorOnMainThread:@selector(_sequelProPostNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#endif
[info release];
}
@@ -81,12 +127,20 @@
@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification
+#endif
{
[[self defaultCenter] postNotification:notification];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationName:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationName:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];
@@ -97,7 +151,11 @@
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationForwarder:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 728c621e..a0fa4c0a 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -438,7 +438,7 @@
[self initiateMySQLConnection];
}
else {
- [tableDocument setTitlebarStatus:NSLocalizedString(@"SSH Connecting…", @"SSH connecting titlebar marker")];
+ [tableDocument setTitlebarStatus:NSLocalizedString(@"SSH Connecting", @"SSH connecting titlebar marker")];
}
}
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 87600d87..39b925c1 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -82,9 +82,15 @@ NSString *SPLoadBlobsAsNeeded = @"LoadBlobsAsNeeded";
NSString *SPTableRowCountQueryLevel = @"TableRowCountQueryLevel";
NSString *SPTableRowCountCheapSizeBoundary = @"TableRowCountCheapLookupSizeBoundary";
NSString *SPNewFieldsAllowNulls = @"NewFieldsAllowNulls";
+#ifndef SP_REFACTOR
NSString *SPLimitResults = @"LimitResults";
NSString *SPLimitResultsValue = @"LimitResultsValue";
NSString *SPNullValue = @"NullValue";
+#else
+NSString *SPLimitResults = @"SPLimitResults";
+NSString *SPLimitResultsValue = @"SPLimitResultsValue";
+NSString *SPNullValue = @"SPNullValue";
+#endif
NSString *SPGlobalResultTableFont = @"GlobalResultTableFont";
NSString *SPFilterTableDefaultOperator = @"FilterTableDefaultOperator";
NSString *SPFilterTableDefaultOperatorLastItems = @"FilterTableDefaultOperatorLastItems";
diff --git a/Source/SPCopyTable.h b/Source/SPCopyTable.h
index b7b5f77d..87c4ec8c 100644
--- a/Source/SPCopyTable.h
+++ b/Source/SPCopyTable.h
@@ -46,9 +46,7 @@
NSString* selectedTable; // the name of the current selected table
SPDataStorage* tableStorage; // the underlying storage array holding the table data
-#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
-#endif
NSRange fieldEditorSelectedRange;
NSString *copyBlobFileDirectory;
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index f297ff76..e1b7e773 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -618,11 +618,7 @@ NSInteger kBlobAsImageFile = 4;
// Loop through the rows, adding their descriptive contents
NSUInteger rowIndex = [selectedRows firstIndex];
-#ifndef SP_REFACTOR
NSString *nullString = [prefs objectForKey:SPNullValue];
-#else
- NSString *nullString = @"NULL";
-#endif
Class nsDataClass = [NSData class];
Class mcpGeometryData = [MCPGeometryData class];
NSStringEncoding connectionEncoding = [mySQLConnection stringEncoding];
@@ -796,11 +792,7 @@ NSInteger kBlobAsImageFile = 4;
// Replace NULLs with their placeholder string
else if ([contentString isNSNull]) {
-#ifndef SP_REFACTOR /* patch */
contentString = [prefs objectForKey:SPNullValue];
-#else
- contentString = @"NULL";
-#endif
// Same for cells for which loading has been deferred - likely blobs
} else if ([contentString isSPNotLoaded]) {
@@ -1434,9 +1426,7 @@ NSInteger kBlobAsImageFile = 4;
- (void) awakeFromNib
{
columnDefinitions = nil;
-#ifndef SP_REFACTOR
prefs = [[NSUserDefaults standardUserDefaults] retain];
-#endif
if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)])
[super awakeFromNib];
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h
index fde7068e..8a1ad793 100644
--- a/Source/SPCustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -129,9 +129,7 @@
SPQueryFavoriteManager *favoritesManager;
-#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
-#endif
MCPConnection *mySQLConnection;
NSString *usedQuery;
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 91570d14..8c2b4f43 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -584,7 +584,11 @@
#endif
// Notify listeners that a query has started
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#endif
#ifndef SP_REFACTOR /* growl */
// Start the notification timer to allow notifications to be shown even if frontmost for long queries
@@ -851,7 +855,11 @@
[customQueryView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
// Notify any listeners that the query has completed
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
#ifndef SP_REFACTOR /* growl */
// Perform the Growl notification for query completion
@@ -884,7 +892,11 @@
}
//query finished
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
#ifndef SP_REFACTOR /* growl */
// Query finished Growl notification
@@ -1156,7 +1168,7 @@
}
/*
- * Add or remove "⁄* *⁄" for each line in the current query
+ * Add or remove "‚ÅÑ* *‚ÅÑ" for each line in the current query
* a given selection
*/
- (void)commentOutCurrentQueryTakingSelection:(BOOL)takeSelection
@@ -1209,8 +1221,8 @@
/*
* Add or remove "-- " for each line in the current query or selection,
- * if the selection is in-line wrap selection into ⁄* block comments and
- * place the caret after ⁄* to allow to enter !xxxxxx e.g.
+ * if the selection is in-line wrap selection into ‚ÅÑ* block comments and
+ * place the caret after ‚ÅÑ* to allow to enter !xxxxxx e.g.
*/
- (void)commentOut
{
@@ -1582,7 +1594,7 @@
[[dataCell formatter] setFieldType:[columnDefinition objectForKey:@"type"]];
[theCol setDataCell:dataCell];
[[theCol headerCell] setStringValue:[columnDefinition objectForKey:@"name"]];
- [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@", [columnDefinition objectForKey:@"name"], [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"char_length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"char_length"]] : @""]];
+ [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@", [columnDefinition objectForKey:@"name"], [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"char_length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"char_length"]] : @""]];
#ifndef SP_REFACTOR
// Set the width of this column to saved value if exists and maps to a real column
@@ -1951,11 +1963,7 @@
return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
if ([theValue isNSNull])
-#ifndef SP_REFACTOR
return [prefs objectForKey:SPNullValue];
-#else
- return @"NULL";
-#endif
if ([theValue isKindOfClass:[MCPGeometryData class]])
return [theValue wktString];
@@ -2010,13 +2018,7 @@
} else {
if ( [[anObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) {
newObject = @"CURRENT_TIMESTAMP";
- } else if([anObject isEqualToString:
-#ifndef SP_REFACTOR
- [prefs stringForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]) {
+ } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) {
newObject = @"NULL";
} else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) {
newObject = [(NSString*)anObject getGeomFromTextString];
@@ -2043,7 +2045,7 @@
return;
}
- // This shouldn't happen – for safety reasons
+ // This shouldn't happen – for safety reasons
if ( ![mySQLConnection affectedRows] ) {
#ifndef SP_REFACTOR
if ( [prefs boolForKey:SPShowNoAffectedRowsError] ) {
@@ -2441,11 +2443,7 @@
id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]];
if ([originalData isNSNull])
-#ifndef SP_REFACTOR
originalData = [NSString stringWithString:[prefs objectForKey:SPNullValue]];
-#else
- originalData = [NSString stringWithString:@"NULL"];
-#endif
[fieldEditor editWithObject:originalData
fieldName:[columnDefinition objectForKey:@"name"]
@@ -3147,7 +3145,7 @@
aRange = [desc rangeOfRegex:@"\\[HELP ([^ ]*?)\\]" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length+53, [desc length]-53-aRange.location-aRange.length) capture:1 error:&err1];
if(aRange.location != NSNotFound) {
aUrl = [[desc substringWithRange:aRange] stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
- [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
+ [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
}
else
break;
@@ -3162,7 +3160,7 @@
// aRange = [desc rangeOfRegex:@"(?<!\\w)([A-Z_]{2,}( [A-Z_]{2,})?)" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1];
// if(aRange.location != NSNotFound) {
// aUrl = [desc substringWithRange:aRange];
- // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
+ // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]];
// }
// else
// break;
@@ -3186,16 +3184,16 @@
if (r) [theResult dataSeek:0];
// check if HELP 'contents' is called
if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING])
- [theHelp appendFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString];
+ [theHelp appendFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString];
else
- [theHelp appendFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString];
+ [theHelp appendFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString];
// iterate through all found rows and print them as HTML ul/li list
[theHelp appendString:@"<ul>"];
for ( i = 0 ; i < r ; i++ ) {
NSArray *anArray = [theResult fetchRowAsArray];
NSString *topic = [anArray objectAtIndex:[anArray count]-2];
- [theHelp appendFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>",
+ [theHelp appendFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>",
NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic];
}
[theHelp appendString:@"</ul>"];
@@ -3377,7 +3375,7 @@
[[[[tableDocumentInstance fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent]
action:NULL keyEquivalent:@""];
[headerMenuItem setTag:SP_FAVORITE_HEADER_MENUITEM_TAG];
- [headerMenuItem setToolTip:[NSString stringWithFormat:@"‘%@’ based favorites",
+ [headerMenuItem setToolTip:[NSString stringWithFormat:@"‘%@’ based favorites",
[[[[tableDocumentInstance fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent]]];
[headerMenuItem setIndentationLevel:0];
[menu addItem:headerMenuItem];
@@ -3389,7 +3387,7 @@
[paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]];
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]];
NSAttributedString *titleString = [[[NSAttributedString alloc]
- initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"]
+ initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@‚á•", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"]
attributes:attributes] autorelease];
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""];
[item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]];
@@ -3414,7 +3412,7 @@
[paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]];
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]];
NSAttributedString *titleString = [[[NSAttributedString alloc]
- initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"]
+ initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@‚á•", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"]
attributes:attributes] autorelease];
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""];
[item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]];
@@ -3516,7 +3514,7 @@
// Result Table Font preference changed
else if ([keyPath isEqualToString:SPGlobalResultTableFont]) {
NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]];
- [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{«û·π∂·∏π√ú‚àëzgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
[customQueryView setFont:tableFont];
[customQueryView reloadData];
}
@@ -3643,7 +3641,7 @@
[menuItem setToolTip:NSLocalizedString(@"Clear the global history list", @"clear the global history list tooltip message")];
#ifndef SP_REFACTOR /* if ( [tableDocumentInstance isUntitled] ) */
} else {
- [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Clear History for “%@”", @"clear history for “%@” menu title"), [tableDocumentInstance displayName]]];
+ [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Clear History for “%@”", @"clear history for “%@” menu title"), [tableDocumentInstance displayName]]];
[menuItem setToolTip:NSLocalizedString(@"Clear the document-based history list", @"clear the document-based history list tooltip message")];
}
#endif
@@ -3728,7 +3726,7 @@
// an error occurred while reading
if (helpHTMLTemplate == nil) {
- NSLog(@"%@", [NSString stringWithFormat:@"Error reading “%@.html”!<br>%@", SPHTMLHelpTemplate, [error localizedFailureReason]]);
+ NSLog(@"%@", [NSString stringWithFormat:@"Error reading “%@.html”!<br>%@", SPHTMLHelpTemplate, [error localizedFailureReason]]);
NSBeep();
}
@@ -3747,9 +3745,7 @@
queryLoadTimer = nil;
-#ifndef SP_REFACTOR
prefs = [NSUserDefaults standardUserDefaults];
-#endif
kCellEditorErrorNoMatch = NSLocalizedString(@"Field is not editable. No matching record found.\nReload data, check encoding, or try to add\na primary key field or more fields\nin your SELECT statement for table '%@'\nto identify field origin unambiguously.", @"Custom Query result editing error - could not identify original row");
kCellEditorErrorNoMultiTabDb = NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database");
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 2586efad..d70a7a40 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -222,7 +222,9 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
// Properties
SPWindowController *parentWindowController;
+#endif
NSWindow *parentWindow;
+#ifndef SP_REFACTOR /* ivars */
NSTabViewItem *parentTabViewItem;
#endif
BOOL isProcessing;
@@ -404,10 +406,10 @@ SPTablesList, SPTableStructure, SPTableContent, SPTableData, SPServerSupport;
- (void)setIsProcessing:(BOOL)value;
- (BOOL)isProcessing;
-#ifndef SP_REFACTOR /* method decls */
- (void)setParentWindow:(NSWindow *)aWindow;
- (NSWindow *)parentWindow;
+#ifndef SP_REFACTOR /* method decls */
// Scripting
- (void)handleSchemeCommand:(NSDictionary*)commandDict;
- (void)registerActivity:(NSDictionary*)commandDict;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index e81a7c05..7bb28a97 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -74,6 +74,7 @@
#ifdef SP_REFACTOR /* headers */
#import "SPAlertSheets.h"
+#import "NSNotificationAdditions.h"
#endif
@interface SPDatabaseDocument (PrivateAPI)
@@ -931,7 +932,11 @@
NSString *dbName = nil;
// Notify listeners that a query has started
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:self];
+#endif
MCPResult *theResult = [mySQLConnection queryString:@"SELECT DATABASE()"];
if (![mySQLConnection queryErrored]) {
@@ -960,7 +965,11 @@
}
//query finished
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:self];
+#endif
}
#ifndef SP_REFACTOR /* navigatorSchemaPathExistsForDatabase: */
@@ -3961,6 +3970,7 @@
// If the task interface is visible, and this tab is frontmost, re-center the task child window
if (_isWorkingLevel && [parentWindowController selectedTableDocument] == self) [self centerTaskWindow];
}
+#endif
/**
* Set the parent window
@@ -3969,7 +3979,9 @@
{
// If the window is being set for the first time - connection controller is visible - update focus
if (!parentWindow && !mySQLConnection) {
+#ifndef SP_REFACTOR
[aWindow makeFirstResponder:[connectionController valueForKey:@"favoritesTable"]];
+#endif
[connectionController performSelector:@selector(updateFavoriteSelection:) withObject:self afterDelay:0.0];
}
@@ -3986,6 +3998,7 @@
return parentWindow;
}
+#ifndef SP_REFACTOR
#pragma mark -
#pragma mark NSDocument compatibility
@@ -5210,7 +5223,11 @@
- (void)registerActivity:(NSDictionary*)commandDict
{
[runningActivitiesArray addObject:commandDict];
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:nil];
+#ifndef SP_REFACTOR
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:self];
+#endif
if([runningActivitiesArray count] || [[[NSApp delegate] runningActivities] count])
[self performSelector:@selector(setActivityPaneHidden:) withObject:[NSNumber numberWithInteger:0] afterDelay:1.0];
@@ -5242,7 +5259,11 @@
[self setActivityPaneHidden:[NSNumber numberWithInteger:1]];
}
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:nil];
+#ifndef SP_REFACTOR
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:self];
+#endif
}
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index 7affec1d..171ff8f6 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -320,7 +320,11 @@
#endif
// Notify listeners of the table change
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#endif
return;
}
@@ -463,7 +467,11 @@
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
// Notify listeners of the table change now that the state is fully set up.
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#ifndef SP_REFACTOR
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:SPTableChangedNotification object:self];
+#endif
#ifndef SP_REFACTOR /* [spHistoryControllerInstance restoreViewStates] */
// Restore view states as appropriate
@@ -473,7 +481,7 @@
// Load the currently selected view if looking at a table or view
if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable))
{
-#ifndef SP_REFACTOR /* load everything in Coda */
+#ifndef SP_REFACTOR /* load everything */
NSInteger selectedTabViewIndex = [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]];
switch (selectedTabViewIndex) {
@@ -481,13 +489,13 @@
#endif
[tableSourceInstance loadTable:selectedTableName];
structureLoaded = YES;
-#ifndef SP_REFACTOR /* load everything in Coda */
+#ifndef SP_REFACTOR /* load everything */
break;
case SPTableViewContent:
#endif
[tableContentInstance loadTable:selectedTableName];
contentLoaded = YES;
-#ifndef SP_REFACTOR /* load everything in Coda */
+#ifndef SP_REFACTOR /* load everything */
break;
case SPTableViewStatus:
[[extendedTableInfoInstance onMainThread] loadTable:selectedTableName];
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index 96d3501f..b629acbf 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -159,9 +159,7 @@
BOOL wasCutPaste;
BOOL selectionChanged;
-#ifndef SP_REFACTOR
NSUserDefaults *prefs;
-#endif
NSDictionary *qlTypes;
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 83a0c9d7..52a90fcd 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -4,7 +4,7 @@
// SPFieldEditorController.m
// sequel-pro
//
-// Created by Hans-Jörg Bibiko on July 16, 2009
+// Created by Hans-Jörg Bibiko on July 16, 2009
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -65,9 +65,8 @@
callerInstance = nil;
doGroupDueToChars = NO;
-#ifndef SP_REFACTOR
prefs = [NSUserDefaults standardUserDefaults];
-#endif
+
// Used for max text length recognition if last typed char is a non-space char
editTextViewWasChanged = NO;
@@ -214,13 +213,7 @@
[bitSheetNULLButton setEnabled:_allowNULL];
// Check for NULL
- if([sheetEditData isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]) {
+ if([sheetEditData isEqualToString:[prefs objectForKey:SPNullValue]]) {
[bitSheetNULLButton setState:NSOnState];
[self setToNull:bitSheetNULLButton];
} else {
@@ -406,13 +399,7 @@
[callerInstance setFieldEditorSelectedRange:NSMakeRange(0,0)];
// If the string content is NULL select NULL for convenience
- if([stringValue isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ])
+ if([stringValue isEqualToString:[prefs objectForKey:SPNullValue]])
[editTextView setSelectedRange:NSMakeRange(0,[[editTextView string] length])];
// Set focus
@@ -583,13 +570,7 @@
// - for max text length (except for NULL value string) select the part which won't be saved
// and suppress closing the sheet
if(sender == editSheetOkButton) {
- if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]) {
+ if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:SPNullValue]]) {
[editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
[editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)];
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %llu.", @"Text is too long. Maximum text length is set to %llu."), maxTextLength]];
@@ -1109,13 +1090,7 @@
[sheetEditData release];
}
- NSString *nullString =
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ;
+ NSString *nullString = [prefs objectForKey:SPNullValue];
sheetEditData = [[NSString stringWithString:nullString] retain];
[bitSheetIntegerTextField setStringValue:nullString];
[bitSheetHexTextField setStringValue:nullString];
@@ -1316,13 +1291,7 @@
{
if(textView == editTextView && (maxTextLength > 0)
- && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]) {
+ && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:SPNullValue]]) {
NSInteger newLength;
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 38f7cfd7..860eef81 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -135,9 +135,7 @@
NSString *sourcePath;
-#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
-#endif
NSInteger heightOffset;
NSUInteger windowMinWidth;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 6ff712b3..a81a942f 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -89,9 +89,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
addGlobalSheetIsOpen = NO;
toBeEditedRowIndexes = [[NSMutableIndexSet alloc] init];
-#ifndef SP_REFACTOR /* init ivars */
prefs = [NSUserDefaults standardUserDefaults];
-#endif
tablesListInstance = [theDelegate valueForKeyPath:@"tablesListInstance"];
databaseDataInstance = [tablesListInstance valueForKeyPath:@"databaseDataInstance"];
@@ -1118,18 +1116,12 @@ static NSString *SPTableViewSqlColumnID = @"sql";
for(id item in [fieldMappingImportArray objectAtIndex:0]) {
i++;
if ([item isNSNull]) {
- [insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. <%@>", i,
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]];
+ [insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. <%@>", i, [prefs objectForKey:SPNullValue]]];
} else if ([item isSPNotLoaded]) {
[insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. <%@>", i, @"DEFAULT"]];
} else {
if([(NSString*)item length] > 20)
- [insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. %@…", i, [item substringToIndex:20]]];
+ [insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. %@", i, [item substringToIndex:20]]];
else
[insertPullDownButton addItemWithTitle:[NSString stringWithFormat:@"%i. %@", i, item]];
}
@@ -1517,13 +1509,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
[fieldMappingButtonOptions setArray:[fieldMappingImportArray objectAtIndex:fieldMappingCurrentRow]];
for (i = 0; i < [fieldMappingButtonOptions count]; i++) {
if ([[fieldMappingButtonOptions objectAtIndex:i] isNSNull])
- [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. <%@>", i+1,
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]];
+ [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]];
else if ([[fieldMappingButtonOptions objectAtIndex:i] isSPNotLoaded])
[fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. <%@>", i+1, @"DEFAULT"]];
else
@@ -1534,13 +1520,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if((NSInteger)[fieldMappingGlobalValues count]>numberOfImportColumns)
for( ; i < [fieldMappingGlobalValues count]; i++) {
if ([NSArrayObjectAtIndex(fieldMappingGlobalValues, i) isNSNull])
- [fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. <%@>", i+1,
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ]];
+ [fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]];
else
[fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. %@", i+1, NSArrayObjectAtIndex(fieldMappingGlobalValues, i)]];
}
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 04627e2d..4b4513a8 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -7,7 +7,7 @@
// Created by Hans-J. Bibiko on May 14, 2009.
//
// This class is based on TextMate's TMDIncrementalPopUp implementation
-// (Dialog plugin) written by Joachim Mårtensson, Allan Odgaard, and H.-J. Bibiko.
+// (Dialog plugin) written by Joachim Mårtensson, Allan Odgaard, and H.-J. Bibiko.
// see license: http://svn.textmate.org/trunk/LICENSE
//
// This program is free software; you can redistribute it and/or modify
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index e7a8cfc2..475b96bc 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -157,7 +157,7 @@ static SPQueryController *sharedQueryController = nil;
*/
- (void)awakeFromNib
{
-#ifndef SP_REFACTOR
+#ifndef SP_REFACTOR /* init ivars */
prefs = [NSUserDefaults standardUserDefaults];
#endif
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index 8ad30614..2b125acd 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -98,9 +98,7 @@
NSNumber *sortCol;
BOOL isEditingRow, isEditingNewRow, isSavingRow, isDesc, setLimit;
BOOL isFiltered, isLimited, isInterruptedLoad, maxNumRowsIsEstimate;
-#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
-#endif
NSInteger currentlyEditingRow, maxNumRows;
NSMutableDictionary *contentFilters;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 821321cb..75338fe1 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -109,9 +109,7 @@
isLimited = NO;
isInterruptedLoad = NO;
-#ifndef SP_REFACTOR /* init ivars */
prefs = [NSUserDefaults standardUserDefaults];
-#endif
usedQuery = [[NSString alloc] initWithString:@""];
@@ -239,7 +237,11 @@
}
// Post a notification that a query will be performed
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#endif
// Set up the table details for the new table, and trigger an interface update
NSDictionary *tableDetails = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -279,7 +281,11 @@
[[tableContentView onMainThread] setNeedsDisplay:YES];
// Post the notification that the query is finished
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
// Clear any details to restore now that they have been restored
[self clearDetailsToRestore];
@@ -459,11 +465,7 @@
}
}
-#ifndef SP_REFACTOR /* patch */
NSString *nullValue = [prefs objectForKey:SPNullValue];
-#else
- NSString* nullValue = @"NULL";
-#endif
#ifndef SP_REFACTOR /* get font from prefs */
NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]];
#else
@@ -478,7 +480,7 @@
// Set up the column
theCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"datacolumnindex"]];
[[theCol headerCell] setStringValue:[columnDefinition objectForKey:@"name"]];
- [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@%@%@",
+ [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@%@%@",
[columnDefinition objectForKey:@"name"],
[columnDefinition objectForKey:@"type"],
([columnDefinition objectForKey:@"length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"length"]] : @"",
@@ -637,9 +639,7 @@
}
// Restore page number if limiting is set
-#ifndef SP_REFACTOR /* patch */
if ([prefs boolForKey:SPLimitResults])
-#endif
contentPage = pageToRestore;
// Restore first responder
@@ -697,7 +697,11 @@
[countText setStringValue:NSLocalizedString(@"Loading table data...", @"Loading table data string")];
// Notify any listeners that a query has started
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#endif
// Start construction of the query string
queryString = [NSMutableString stringWithFormat:@"SELECT %@%@ FROM %@", (activeFilter == 1 && [self tableFilterString] && filterTableDistinct) ? @"DISTINCT " : @"", [self fieldListForQuery], [selectedTable backtickQuotedString]];
@@ -718,23 +722,14 @@
if (isDesc) [queryString appendString:@" DESC"];
}
-#ifndef SP_REFACTOR /* patch */
// Check to see if a limit needs to be applied
if ([prefs boolForKey:SPLimitResults])
-#else
- if ( YES )
-#endif
{
// Ensure the page supplied is within the appropriate limits
if (contentPage <= 0)
contentPage = 1;
-#ifndef SP_REFACTOR /* patch */
else if (contentPage > 1 && (NSInteger)(contentPage - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows)
contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
-#else
- else if (contentPage > 1 && (contentPage - 1) * 1000 >= maxNumRows)
- contentPage = ceil((CGFloat)maxNumRows / 1000);
-#endif
// If the result set is from a late page, take a copy of the string to allow resetting limit
// if no results are found
@@ -743,22 +738,11 @@
}
// Append the limit settings
- [queryString appendFormat:@" LIMIT %ld,%ld", (long)((contentPage-1)*
-#ifndef SP_REFACTOR /* patch */
- [prefs integerForKey:SPLimitResultsValue]), (long)[prefs integerForKey:SPLimitResultsValue]
-#else
- 1000), (long)1000
-#endif
- ];
+ [queryString appendFormat:@" LIMIT %ld,%ld", (long)((contentPage-1)*[prefs integerForKey:SPLimitResultsValue]), (long)[prefs integerForKey:SPLimitResultsValue]];
// Update the approximate count of the rows to load
-#ifndef SP_REFACTOR /* patch */
rowsToLoad = rowsToLoad - (contentPage-1)*[prefs integerForKey:SPLimitResultsValue];
if (rowsToLoad > [prefs integerForKey:SPLimitResultsValue]) rowsToLoad = [prefs integerForKey:SPLimitResultsValue];
-#else
- rowsToLoad = rowsToLoad - (contentPage-1)*1000;
- if (rowsToLoad > 1000) rowsToLoad = 1000;
-#endif
}
// If within a task, allow this query to be cancelled
@@ -786,30 +770,14 @@
if (streamingResult) [streamingResult release];
// If the result is empty, and a late page is selected, reset the page
- if (!fullTableReloadRequired
-#ifndef SP_REFACTOR
- && [prefs boolForKey:SPLimitResults]
-#endif
- && queryStringBeforeLimit && !tableRowsCount && ![mySQLConnection queryCancelled]) {
+ if (!fullTableReloadRequired && [prefs boolForKey:SPLimitResults] && queryStringBeforeLimit && !tableRowsCount && ![mySQLConnection queryCancelled]) {
contentPage = 1;
previousTableRowsCount = tableRowsCount;
- queryString = [NSMutableString stringWithFormat:@"%@ LIMIT 0,%ld", queryStringBeforeLimit,
-#ifndef SP_REFACTOR
- (long)[prefs integerForKey:SPLimitResultsValue]
-#else
- (long)1000
-#endif
- ];
+ queryString = [NSMutableString stringWithFormat:@"%@ LIMIT 0,%ld", queryStringBeforeLimit, (long)[prefs integerForKey:SPLimitResultsValue]];
[self setUsedQuery:queryString];
streamingResult = [[mySQLConnection streamingQueryString:queryString] retain];
if (streamingResult) {
- [self processResultIntoDataStorage:streamingResult approximateRowCount:
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- ];
+ [self processResultIntoDataStorage:streamingResult approximateRowCount:[prefs integerForKey:SPLimitResultsValue]];
[streamingResult release];
}
}
@@ -822,17 +790,7 @@
// End cancellation ability
[tableDocumentInstance disableTaskCancellation];
- if (
-#ifndef SP_REFACTOR
- [prefs boolForKey:SPLimitResults] &&
-#endif
- (contentPage > 1 || (NSInteger)tableRowsCount ==
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- ))
+ if ([prefs boolForKey:SPLimitResults] && (contentPage > 1 || (NSInteger)tableRowsCount == [prefs integerForKey:SPLimitResultsValue]))
{
isLimited = YES;
} else {
@@ -854,7 +812,11 @@
// Notify listenters that the query has finished
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
if ([mySQLConnection queryErrored] && ![mySQLConnection queryCancelled]) {
if(activeFilter == 0) {
@@ -867,7 +829,7 @@
}
// Filter task came from filter table
else if(activeFilter == 1){
- [filterTableWindow setTitle:[NSString stringWithFormat:@"%@ – %@", NSLocalizedString(@"Filter", @"filter label"), NSLocalizedString(@"WHERE clause not valid", @"WHERE clause not valid")]];
+ [filterTableWindow setTitle:[NSString stringWithFormat:@"%@ – %@", NSLocalizedString(@"Filter", @"filter label"), NSLocalizedString(@"WHERE clause not valid", @"WHERE clause not valid")]];
}
} else {
// Trigger a full reload if required
@@ -998,7 +960,7 @@
}
// If the clause has the placeholder $BINARY that placeholder will be replaced
- // by BINARY if the user pressed ⇧ while invoking 'Filter' otherwise it will
+ // by BINARY if the user pressed ‚áß while invoking 'Filter' otherwise it will
// replaced by @"".
BOOL caseSensitive = (([[[NSApp onMainThread] currentEvent] modifierFlags]
& (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)) > 0);
@@ -1013,14 +975,14 @@
// Current selected filter type
if(![contentFilters objectForKey:compareType]) {
- NSLog(@"Error while retrieving filters. Filter type “%@” unknown.", compareType);
+ NSLog(@"Error while retrieving filters. Filter type “%@” unknown.", compareType);
NSBeep();
return nil;
}
NSDictionary *filter = [[contentFilters objectForKey:compareType] objectAtIndex:[[compareField selectedItem] tag]];
if(![filter objectForKey:@"NumberOfArguments"]) {
- NSLog(@"Error while retrieving filter clause. No “Clause” or/and “NumberOfArguments” key found.");
+ NSLog(@"Error while retrieving filter clause. No “Clause” or/and “NumberOfArguments” key found.");
NSBeep();
return nil;
}
@@ -1091,7 +1053,7 @@
// Check number of placeholders and given 'NumberOfArguments'
if([clause replaceOccurrencesOfString:@"%@" withString:@"%@" options:NSLiteralSearch range:NSMakeRange(0, [clause length])] != numberOfArguments) {
- NSLog(@"Error while setting filter string. “NumberOfArguments” differs from the number of arguments specified in “Clause”.");
+ NSLog(@"Error while setting filter string. “NumberOfArguments” differs from the number of arguments specified in “Clause”.");
NSBeep();
[argument release];
[firstBetweenArgument release];
@@ -1209,13 +1171,7 @@
// If a limit is active, display a string suggesting a limit is active
} else if (!isFiltered && isLimited) {
- NSUInteger limitStart = (contentPage-1)*
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- + 1;
+ NSUInteger limitStart = (contentPage-1)*[prefs integerForKey:SPLimitResultsValue] + 1;
[countString appendFormat:NSLocalizedString(@"Rows %@ - %@ of %@%@ from table", @"text showing how many rows are in the limited result"), [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:limitStart]], [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:(limitStart+tableRowsCount-1)]], maxNumRowsIsEstimate?@"~":@"", maxRowsString];
// If just a filter is active, show a count and an indication a filter is active
@@ -1227,13 +1183,7 @@
// If both a filter and limit is active, display full string
} else {
- NSUInteger limitStart = (contentPage-1)*
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- + 1;
+ NSUInteger limitStart = (contentPage-1)*[prefs integerForKey:SPLimitResultsValue] + 1;
[countString appendFormat:NSLocalizedString(@"Rows %@ - %@ from filtered matches", @"text showing how many rows are in the limited filter match"), [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:limitStart]], [numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:(limitStart+tableRowsCount-1)]]];
}
@@ -1400,26 +1350,10 @@
[self setPaginationViewVisibility:FALSE];
// Select the correct pagination value
- if (
-#ifndef SP_REFACTOR
- ![prefs boolForKey:SPLimitResults] ||
-#endif
- [paginationPageField integerValue] <= 0)
+ if (![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0)
contentPage = 1;
- else if (([paginationPageField integerValue] - 1) *
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- >= maxNumRows)
- contentPage = ceil((CGFloat)maxNumRows /
-#ifndef SP_REFACTOR
- [prefs floatForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- );
+ else if (([paginationPageField integerValue] - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows)
+ contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
else
contentPage = [paginationPageField integerValue];
@@ -1465,7 +1399,7 @@
- (IBAction)toggleFilterField:(id)sender
{
- // Check if user called "Edit Filter…"
+ // Check if user called "Edit Filter…"
if([[compareField selectedItem] tag] == (NSInteger)[[contentFilters objectForKey:compareType] count]) {
[self openContentFilterManager];
return;
@@ -1541,13 +1475,7 @@
[paginationPageField setIntegerValue:(contentPage - 1)];
[self filterTable:sender];
} else if (sender == paginationNextButton) {
- if ((NSInteger)contentPage *
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- >= maxNumRows) return;
+ if ((NSInteger)contentPage * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) return;
[paginationPageField setIntegerValue:(contentPage + 1)];
[self filterTable:sender];
}
@@ -1600,13 +1528,7 @@
*/
- (void) updatePaginationState
{
- NSUInteger maxPage = ceil((CGFloat)maxNumRows /
-#ifndef SP_REFACTOR
- [prefs floatForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- );
+ NSUInteger maxPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
if (isFiltered && !isLimited) {
maxPage = contentPage;
}
@@ -1616,21 +1538,13 @@
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
// Set up the previous page button
- if (
-#ifndef SP_REFACTOR
- [prefs boolForKey:SPLimitResults] &&
-#endif
- contentPage > 1)
+ if ([prefs boolForKey:SPLimitResults] && contentPage > 1)
[paginationPreviousButton setEnabled:enabledMode];
else
[paginationPreviousButton setEnabled:NO];
// Set up the next page button
- if (
-#ifndef SP_REFACTOR
- [prefs boolForKey:SPLimitResults] &&
-#endif
- contentPage < maxPage)
+ if ([prefs boolForKey:SPLimitResults] && contentPage < maxPage)
[paginationNextButton setEnabled:enabledMode];
else
[paginationNextButton setEnabled:NO];
@@ -2521,7 +2435,7 @@
[tip setString:[[filter objectForKey:@"Clause"] stringByReplacingOccurrencesOfRegex:@"(?<!\\\\)(\\$\\{.*?\\})" withString:@"[arg]"]];
if([tip isMatchedByRegex:@"(?<!\\\\)\\$BINARY"]) {
[tip replaceOccurrencesOfRegex:@"(?<!\\\\)\\$BINARY" withString:@""];
- [tip appendString:NSLocalizedString(@"\n\nPress ⇧ for binary search (case-sensitive).", @"\n\npress shift for binary search tooltip message")];
+ [tip appendString:NSLocalizedString(@"\n\nPress ‚áß for binary search (case-sensitive).", @"\n\npress shift for binary search tooltip message")];
}
[tip flushCachedRegexData];
[tip replaceOccurrencesOfRegex:@"(?<!\\\\)\\$CURRENT_FIELD" withString:[[fieldField titleOfSelectedItem] backtickQuotedString]];
@@ -2539,8 +2453,8 @@
}
[menu addItem:[NSMenuItem separatorItem]];
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Filters…", @"edit filter") action:NULL keyEquivalent:@""];
- [item setToolTip:NSLocalizedString(@"Edit user-defined Filters…", @"edit user-defined filter")];
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Filters…", @"edit filter") action:NULL keyEquivalent:@""];
+ [item setToolTip:NSLocalizedString(@"Edit user-defined Filters…", @"edit user-defined filter")];
[item setTag:i];
[menu addItem:item];
[item release];
@@ -2666,7 +2580,11 @@
[rowValuesToSave addObject:fieldValue];
}
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#endif
NSMutableString *queryString;
// Use INSERT syntax when creating new rows
@@ -2692,7 +2610,11 @@
// Run the query
[mySQLConnection queryString:queryString];
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
// If no rows have been changed, show error if appropriate.
if ( ![mySQLConnection affectedRows] && ![mySQLConnection queryErrored] ) {
@@ -2934,7 +2856,7 @@
[argument appendFormat:@"%@ IS NULL", [NSArrayObjectAtIndex(keys, i) backtickQuotedString]];
}
else if ([tempValue isSPNotLoaded]) {
- NSLog(@"Exceptional case: SPNotLoaded object found for method “argumentForRow:”!");
+ NSLog(@"Exceptional case: SPNotLoaded object found for method “argumentForRow:”!");
return @"";
}
else {
@@ -3176,13 +3098,7 @@
}
if ([data isKindOfClass:[NSString class]]
- && [data isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ] && [[NSArrayObjectAtIndex(dataColumns, column) objectForKey:@"null"] boolValue])
+ && [data isEqualToString:[prefs objectForKey:SPNullValue]] && [[NSArrayObjectAtIndex(dataColumns, column) objectForKey:@"null"] boolValue])
{
data = [[NSNull null] retain];
}
@@ -3616,25 +3532,11 @@
// Check whether the estimated count requires updating, ie if the retrieved count exceeds it
if (checkStatusCount) {
NSInteger foundMaxRows;
-#ifndef SP_REFACTOR
if ([prefs boolForKey:SPLimitResults])
-#else
- if ( YES )
-#endif
{
- foundMaxRows = ((contentPage - 1) *
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- ) + tableRowsCount;
+ foundMaxRows = ((contentPage - 1) * [prefs integerForKey:SPLimitResultsValue]) + tableRowsCount;
if (foundMaxRows > maxNumRows) {
-#ifndef SP_REFACTOR
if ((NSInteger)tableRowsCount == [prefs integerForKey:SPLimitResultsValue])
-#else
- if (tableRowsCount == 1000)
-#endif
{
maxNumRows = foundMaxRows + 1;
maxNumRowsIsEstimate = YES;
@@ -3642,13 +3544,7 @@
maxNumRows = foundMaxRows;
maxNumRowsIsEstimate = NO;
}
- } else if (!isInterruptedLoad && !isFiltered && (NSInteger)tableRowsCount <
-#ifndef SP_REFACTOR
- [prefs integerForKey:SPLimitResultsValue]
-#else
- 1000
-#endif
- ) {
+ } else if (!isInterruptedLoad && !isFiltered && (NSInteger)tableRowsCount < [prefs integerForKey:SPLimitResultsValue]) {
maxNumRows = foundMaxRows;
maxNumRowsIsEstimate = NO;
}
@@ -3836,11 +3732,7 @@
return [theValue wktString];
if ([theValue isNSNull])
-#ifndef SP_REFACTOR
return [prefs objectForKey:SPNullValue];
-#else
- return @"NULL";
-#endif
if ([theValue isKindOfClass:[NSData class]])
return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
@@ -3978,11 +3870,7 @@
} else {
if ( [[anObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) {
newObject = @"CURRENT_TIMESTAMP";
-#ifndef SP_REFACTOR
} else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) {
-#else
- } else if([anObject isEqualToString:@"NULL"]) {
-#endif
newObject = @"NULL";
} else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) {
newObject = [(NSString*)anObject getGeomFromTextString];
@@ -4013,7 +3901,7 @@
}
- // This shouldn't happen – for safety reasons
+ // This shouldn't happen – for safety reasons
if ( ![mySQLConnection affectedRows] ) {
#ifndef SP_REFACTOR
if ( [prefs boolForKey:SPShowNoAffectedRowsError] ) {
@@ -4076,13 +3964,7 @@
if (anObject) {
// Restore NULLs if necessary
- if ([anObject isEqualToString:
-#ifndef SP_REFACTOR
- [prefs objectForKey:SPNullValue]
-#else
- @"NULL"
-#endif
- ] && [[column objectForKey:@"null"] boolValue])
+ if ([anObject isEqualToString:[prefs objectForKey:SPNullValue]] && [[column objectForKey:@"null"] boolValue])
anObject = [NSNull null];
[tableValues replaceObjectInRow:rowIndex column:[[aTableColumn identifier] integerValue] withObject:anObject];
@@ -4389,11 +4271,8 @@
id cellValue = [tableValues cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]];
if ([cellValue isNSNull])
-#ifndef SP_REFACTOR
cellValue = [NSString stringWithString:[prefs objectForKey:SPNullValue]];
-#else
- cellValue = [NSString stringWithString:@"NULL"];
-#endif
+
NSInteger editedColumn = 0;
for(NSTableColumn* col in [tableContentView tableColumns]) {
if([[col identifier] isEqualToNumber:[aTableColumn identifier]]) break;
@@ -4431,7 +4310,7 @@
if (aTableView == tableContentView) {
NSString *tmp;
- // By holding ⌘, ⇧, or/and ⌥ copies selected rows as SQL INSERTS
+ // By holding ‚åò, ‚áß, or/and ‚å• copies selected rows as SQL INSERTS
// otherwise \t delimited lines
if([[NSApp currentEvent] modifierFlags] & (NSCommandKeyMask|NSShiftKeyMask|NSAlternateKeyMask))
tmp = [tableContentView rowsAsSqlInsertsOnlySelectedRows:YES];
@@ -4744,7 +4623,7 @@
// Table font preference changed
else if ([keyPath isEqualToString:SPGlobalResultTableFont]) {
NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]];
- [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{«û·π∂·∏π√ú‚àëzgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
[tableContentView setFont:tableFont];
[tableContentView reloadData];
}
@@ -4803,7 +4682,7 @@
BOOL lookInAllFields = NO;
- NSString *re1 = @"^\\s*(<[=>]?|>=?|!?=|≠|≤|≥)\\s*(.*?)\\s*$";
+ NSString *re1 = @"^\\s*(<[=>]?|>=?|!?=|≠|≤|≥)\\s*(.*?)\\s*$";
NSString *re2 = @"^\\s*(.*)\\s+(.*?)\\s*$";
NSInteger editedRow = [filterTableView editedRow];
@@ -4849,9 +4728,9 @@
if([filterCell length]) {
// Recode special operators
- filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*≠" withString:@"!="];
- filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*≤" withString:@"<="];
- filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*≥" withString:@">="];
+ filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*≠" withString:@"!="];
+ filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*≤" withString:@"<="];
+ filterCell = [filterCell stringByReplacingOccurrencesOfRegex:@"^\\s*‚â•" withString:@">="];
if(numberOfValues)
[clause appendString:(lookInAllFields) ? @" OR " : @" AND "];
diff --git a/Source/SPTableStructure.h b/Source/SPTableStructure.h
index 02313094..81905410 100644
--- a/Source/SPTableStructure.h
+++ b/Source/SPTableStructure.h
@@ -72,9 +72,7 @@
NSMutableDictionary *oldRow, *enumFields;
NSDictionary *defaultValues;
NSInteger currentlyEditingRow;
-#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
-#endif
NSArray *collations;
NSArray *typeSuggestions;
NSArray *extraFieldSuggestions;
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 31ba47f3..1af8bc62 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -68,9 +68,7 @@
fieldValidation = [[SPTableFieldValidation alloc] init];
-#ifndef SP_REFACTOR /* patch */
prefs = [NSUserDefaults standardUserDefaults];
-#endif
}
return self;
@@ -236,7 +234,11 @@
// If an error occurred, reset the interface and abort
if ([mySQLConnection queryErrored]) {
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
[[self onMainThread] setTableDetails:nil];
if ([mySQLConnection isConnected]) {
@@ -337,11 +339,7 @@
if(![theField objectForKey:@"default"])
[theField setObject:@"" forKey:@"default"];
else if([[theField objectForKey:@"default"] isKindOfClass:[NSNull class]])
-#ifndef SP_REFACTOR /* patch */
[theField setObject:[prefs stringForKey:SPNullValue] forKey:@"default"];
-#else
- [theField setObject:@"NULL" forKey:@"default"];
-#endif
// Init Extra field
[theField setObject:@"None" forKey:@"Extra"];
@@ -368,7 +366,11 @@
autoIncrementIndex = nil;
// Send the query finished/work complete notification
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
[theTableFields release];
}
@@ -477,7 +479,7 @@
NSInteger insertIndex = ([tableSourceView numberOfSelectedRows] == 0 ? [tableSourceView numberOfRows] : [tableSourceView selectedRow] + 1);
-#ifndef SP_REFACTOR
+#ifndef SP_REFACTOR /* prefs access */
[tableFields insertObject:[NSMutableDictionary
dictionaryWithObjects:[NSArray arrayWithObjects:@"", @"INT", @"", @"0", @"0", @"0", ([prefs boolForKey:SPNewFieldsAllowNulls]) ? @"1" : @"0", @"", [prefs stringForKey:SPNullValue], @"None", @"", [NSNumber numberWithInt:0], [NSNumber numberWithInt:0], nil]
forKeys:[NSArray arrayWithObjects:@"name", @"type", @"length", @"unsigned", @"zerofill", @"binary", @"null", @"Key", @"default", @"Extra", @"comment", @"encoding", @"collation", nil]]
@@ -854,11 +856,7 @@
NSMutableDictionary *tempRow;
NSArray *keys;
NSInteger i;
-#ifndef SP_REFACTOR /* patch */
id prefsNullValue = [prefs objectForKey:SPNullValue];
-#else
- id prefsNullValue = @"NULL";
-#endif
// Ensure table information is returned as strings to avoid problems with some server versions
[theResult setReturnDataAsStrings:YES];
@@ -984,11 +982,7 @@
[queryString appendString:@"\n NULL"];
}
// If a NULL value has been specified, and NULL is allowed, specify DEFAULT NULL
-#ifndef SP_REFACTOR /* patch */
if ([[theRow objectForKey:@"default"] isEqualToString:[prefs objectForKey:SPNullValue]])
-#else
- if ([[theRow objectForKey:@"default"] isEqualToString:@"NULL"])
-#endif
{
if ([[theRow objectForKey:@"null"] integerValue] == 1) {
[queryString appendString:@"\n DEFAULT NULL "];
@@ -1061,11 +1055,7 @@
if (![theRowExtra isEqualToString:@"AUTO_INCREMENT"]) {
// If a NULL value has been specified, and NULL is allowed, specify DEFAULT NULL
-#ifndef SP_REFACTOR /* patch */
if ([[theRow objectForKey:@"default"] isEqualToString:[prefs objectForKey:SPNullValue]])
-#else
- if ([[theRow objectForKey:@"default"] isEqualToString:@"NULL"])
-#endif
{
if ([[theRow objectForKey:@"null"] integerValue] == 1) {
[queryString appendString:@"\n DEFAULT NULL"];
@@ -1403,17 +1393,9 @@
- (NSString *)defaultValueForField:(NSString *)field
{
if ( ![defaultValues objectForKey:field] ) {
-#ifndef SP_REFACTOR /* patch */
return [prefs objectForKey:SPNullValue];
-#else
- return @"NULL";
-#endif
} else if ( [[defaultValues objectForKey:field] isMemberOfClass:[NSNull class]] ) {
-#ifndef SP_REFACTOR /* patch */
return [prefs objectForKey:SPNullValue];
-#else
- return @"NULL";
-#endif
} else {
return [defaultValues objectForKey:field];
}
@@ -1462,11 +1444,7 @@
NSMutableArray *tempResult = [NSMutableArray array];
NSMutableArray *tempResult2 = [NSMutableArray array];
-#ifndef SP_REFACTOR /* patch */
NSString *nullValue = [prefs stringForKey:SPNullValue];
-#else
- NSString *nullValue = @"NULL";
-#endif
CFStringRef escapedNullValue = CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL);
MCPResult *structureQueryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]];
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index 73496e94..e7f9d3be 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -150,11 +150,7 @@
else if([[aTableColumn identifier] isEqualToString:@"null"]) {
if([[currentRow objectForKey:@"null"] integerValue] != [anObject integerValue]) {
if([anObject integerValue] == 0) {
-#ifndef SP_REFACTOR /* patch */
if([[currentRow objectForKey:@"default"] isEqualToString:[prefs objectForKey:SPNullValue]])
-#else
- if([[currentRow objectForKey:@"default"] isEqualToString:@"NULL"])
-#endif
[currentRow setObject:@"" forKey:@"default"];
}
[tableSourceView reloadData];
@@ -313,11 +309,7 @@
// Add the default value, skip it for auto_increment
if([originalRow objectForKey:@"Extra"] && ![[originalRow objectForKey:@"Extra"] isEqualToString:@"auto_increment"]) {
-#ifndef SP_REFACTOR /* patch */
if ([[originalRow objectForKey:@"default"] isEqualToString:[prefs objectForKey:SPNullValue]]) {
-#else
- if ([[originalRow objectForKey:@"default"] isEqualToString:@"NULL"]) {
-#endif
if ([[originalRow objectForKey:@"null"] integerValue] == 1) {
[queryString appendString:(isTimestampType) ? @" NULL DEFAULT NULL" : @" DEFAULT NULL"];
}
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index c7f3bc1f..5ccb9bae 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -103,7 +103,11 @@
if ([tableDocumentInstance database]) {
// Notify listeners that a query has started
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
+#endif
// Use UTF8 for identifier-based queries
if (changeEncoding) {
@@ -240,7 +244,11 @@
if (changeEncoding) [mySQLConnection restoreStoredEncoding];
// Notify listeners that the query has finished
+#ifndef SP_REFACTOR
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#else
+ [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
+#endif
}
// Add the table headers even if no tables were found
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index 84937e2d..b9ec6459 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -112,7 +112,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
- (void) awakeFromNib
{
-#ifndef SP_REFACTOR
+#ifndef SP_REFACTOR /* init ivars */
prefs = [[NSUserDefaults standardUserDefaults] retain];
[self setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
#endif
@@ -1825,9 +1825,9 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
[theHintString flushCachedRegexData];
#ifndef SP_REFACTOR
- // If inside the snippet hint $(…) is defined run … as BASH command
- // and replace $(…) by the return string of that command. Please note
- // only one $(…) statement is allowed within one ${…} snippet environment.
+ // If inside the snippet hint $() is defined run as BASH command
+ // and replace $() by the return string of that command. Please note
+ // only one $() statement is allowed within one ${} snippet environment.
NSRange tagRange = [theHintString rangeOfRegex:@"(?s)(?<!\\\\)\\$\\((.*)\\)"];
if(tagRange.length) {
[theHintString flushCachedRegexData];
@@ -2129,7 +2129,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
// Check if user pressed ⌥ to allow composing of accented characters.
- // e.g. for US keyboard "⌥ a" to insert ä
+ // e.g. for US keyboard "⌥u a" to insert ä
// or for non-US keyboards to allow to enter dead keys
// e.g. for German keyboard ` is a dead key, press space to enter `
if (([theEvent modifierFlags] & allFlags) == NSAlternateKeyMask || [[theEvent characters] length] == 0)
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 74c60987..c23bd14e 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -4,7 +4,7 @@
// SPTextViewAdditions.m
// sequel-pro
//
-// Created by Hans-Jörg Bibiko on April 05, 2009
+// Created by Hans-Jrg Bibiko on April 05, 2009
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -389,17 +389,12 @@
*/
- (IBAction)insertNULLvalue:(id)sender
{
-#ifndef SP_REFACTOR
-
id prefs = [NSUserDefaults standardUserDefaults];
-#endif
if([self respondsToSelector:@selector(insertText:)])
{
-#ifndef SP_REFACTOR
if([prefs objectForKey:SPNullValue] && [(NSString*)[prefs objectForKey:SPNullValue] length])
[self insertText:[prefs objectForKey:SPNullValue]];
else
-#endif
[self insertText:@"NULL"];
}
}
@@ -529,7 +524,7 @@
mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
if(!cmdData || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
- NSLog(@"“%@” file couldn't be read.", infoPath);
+ NSLog(@"%@ file couldn't be read.", infoPath);
NSBeep();
if (cmdData) [cmdData release];
return;
@@ -648,7 +643,7 @@
if(inputFileError != nil) {
NSString *errorMessage = [inputFileError localizedDescription];
SPBeginAlertSheet(NSLocalizedString(@"Bundle Error", @"bundle error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil,
- [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]);
+ [NSString stringWithFormat:@"%@ %@:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]);
if (cmdData) [cmdData release];
return;
}
@@ -768,7 +763,7 @@
} else if([err code] != 9) { // Suppress an error message if command was killed
NSString *errorMessage = [err localizedDescription];
SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil,
- [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]);
+ [NSString stringWithFormat:@"%@ %@:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]);
}
}