aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNarrowDownCompletion.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-03-28 23:57:28 +0000
committerBibiko <bibiko@eva.mpg.de>2010-03-28 23:57:28 +0000
commit24b365b2a177d7de4cdbb7601424b6b1098a8414 (patch)
tree93959dbd99e4cb2b3b1ffcd9b264b241dabd1824 /Source/SPNarrowDownCompletion.m
parenta7800682c2a2fcd9bb5c85d2f5f965486b3a72d5 (diff)
downloadsequelpro-24b365b2a177d7de4cdbb7601424b6b1098a8414.tar.gz
sequelpro-24b365b2a177d7de4cdbb7601424b6b1098a8414.tar.bz2
sequelpro-24b365b2a177d7de4cdbb7601424b6b1098a8414.zip
- db structure for tables and views will now be queried by using SHOW… statements
- completion now works for server versions < 5 as well - proc/func info will be queried by using information_schema for mysql >= 5 - changed completion logic to handle new format - completion will get the info from SPNavigator since this controller caches all information about db structure - optimization and fine-tuning will follow very soon
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r--Source/SPNarrowDownCompletion.m14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 40cbd2d9..cf5abb49 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -432,7 +432,10 @@
NSMenu *m = [[NSMenu alloc] init];
for(id p in [[[[[filtered objectAtIndex:rowIndex] objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] reverseObjectEnumerator] allObjects])
[m addItemWithTitle:p action:NULL keyEquivalent:@""];
- [m removeItemAtIndex:[m numberOfItems]-1];
+ if([m numberOfItems]>2) {
+ [m removeItemAtIndex:[m numberOfItems]-1];
+ [m removeItemAtIndex:0];
+ }
[b setMenu:m];
[m release];
[b setPreferredEdge:NSMinXEdge];
@@ -492,7 +495,7 @@
c = [[self filterString] characterAtIndex:i];
if(c != '`') {
if(c == '.')
- [fuzzyRegexp appendString:[NSString stringWithFormat:@".*?",SPUniqueSchemaDelimiter]];
+ [fuzzyRegexp appendString:[NSString stringWithFormat:@".*?%@",SPUniqueSchemaDelimiter]];
else if (c == '(' || c == ')' || c == '[' || c == ']' || c == '{' || c == '}')
[fuzzyRegexp appendString:[NSString stringWithFormat:@".*?\\%c",c]];
else
@@ -805,9 +808,10 @@
if([selectedItem objectForKey:@"isRef"]
&& ([[NSApp currentEvent] modifierFlags] & (NSShiftKeyMask))
&& [[selectedItem objectForKey:@"path"] length]) {
- NSString *path = [NSString stringWithFormat:@"%@.%@",
- [[[selectedItem objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] componentsJoinedByPeriodAndBacktickQuotedAndIgnoreFirst],
- [candidateMatch backtickQuotedString]];
+ // NSString *path = [NSString stringWithFormat:@"%@.%@",
+ // [[[selectedItem objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] componentsJoinedByPeriodAndBacktickQuotedAndIgnoreFirst],
+ // [candidateMatch backtickQuotedString]];
+ NSString *path = [[[selectedItem objectForKey:@"path"] componentsSeparatedByString:SPUniqueSchemaDelimiter] componentsJoinedByPeriodAndBacktickQuotedAndIgnoreFirst];
// Check if path's db name is the current selected db name
NSRange r = [path rangeOfString:[currentDb backtickQuotedString] options:NSCaseInsensitiveSearch range:NSMakeRange(0, [[currentDb backtickQuotedString] length])];