diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-07-29 14:33:58 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-07-29 14:33:58 +0000 |
commit | 24cdce10cbd4817682b0ecaf2b834f7dc18cb3b5 (patch) | |
tree | f3a09ed02faaf156351bb1ee660c30e867980e5e /Source | |
parent | 11740d2b61c1a9811f818b06c2ad0e763b129656 (diff) | |
download | sequelpro-24cdce10cbd4817682b0ecaf2b834f7dc18cb3b5.tar.gz sequelpro-24cdce10cbd4817682b0ecaf2b834f7dc18cb3b5.tar.bz2 sequelpro-24cdce10cbd4817682b0ecaf2b834f7dc18cb3b5.zip |
- don't add an empty query to history
- suppress "error highlighting" for an empty query - this also fixes the issue for inserting an history/favorite item after executing an empty query (due to an exception it wasn't possible)
- removed several test NSLogs
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CustomQuery.m | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 6526c222..d22d4cce 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -140,7 +140,7 @@ - (IBAction)chooseQueryFavorite:(id)sender { if ( [queryFavoritesButton indexOfSelectedItem] == 1) { -//save query to favorites + //save query to favorites //check if favorite doesn't exist NSEnumerator *enumerator = [queryFavorites objectEnumerator]; id favorite; @@ -161,7 +161,7 @@ [prefs setObject:queryFavorites forKey:@"queryFavorites"]; [self setFavorites]; } else if ( [queryFavoritesButton indexOfSelectedItem] == 2) { -//edit favorites + //edit favorites [NSApp beginSheet:queryFavoritesSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; @@ -534,9 +534,9 @@ [errors setString:[mySQLConnection getLastErrorMessage]]; } - //add query to history + // add query to history // if(!queriesSeparatedByDelimiter) { // TODO only add to history if no “delimiter” command was used - if(!tableReloadAfterEditing) { + if(!tableReloadAfterEditing && [usedQuery length]) { [queryHistoryButton insertItemWithTitle:usedQuery atIndex:1]; int maxHistoryItems = [[prefs objectForKey:@"CustomQueryMaxHistoryItems"] intValue]; @@ -583,7 +583,8 @@ { BOOL isLookBehind = YES; queryRange = [self queryRangeAtPosition:[textView selectedRange].location lookBehind:&isLookBehind]; - [textView setSelectedRange:queryRange]; + if(queryRange.length) + [textView setSelectedRange:queryRange]; } else { // select the query for which the first error was detected queryRange = [self queryTextRangeForQuery:firstErrorOccuredInQuery startPosition:queryStartPosition]; @@ -1451,6 +1452,7 @@ // Order by the column position number to avoid ambiguous name errors NSString* newOrder = [NSString stringWithFormat:@" ORDER BY %i %@ ", [[tableColumn identifier] intValue]+1, (isDesc)?@"DESC":@"ASC"]; + // Remove any comments [queryString replaceOccurrencesOfRegex:@"--.*?\n" withString:@""]; [queryString replaceOccurrencesOfRegex:@"--.*?$" withString:@""]; [queryString replaceOccurrencesOfRegex:@"/\\*(.|\n)*?\\*/" withString:@""]; @@ -1733,15 +1735,14 @@ { // Abort if still loading the table if (![cqColumnDefinition count]) return; -NSLog(@"start"); + // Retrieve the original index of the column from the identifier int columnIndex = [[[[aNotification userInfo] objectForKey:@"NSTableColumn"] identifier] intValue]; NSDictionary *columnDefinition = NSArrayObjectAtIndex(cqColumnDefinition, columnIndex); - NSLog(@"1"); + // Don't save if the column doesn't map to an underlying SQL field if (![columnDefinition objectForKey:@"org_name"] || ![[columnDefinition objectForKey:@"org_name"] length]) return; - NSLog(@"2"); NSMutableDictionary *tableColumnWidths; NSString *host_db = [NSString stringWithFormat:@"%@@%@", [columnDefinition objectForKey:@"db"], [tableDocumentInstance host]]; |