aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 49b97008..bba94272 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -1051,6 +1051,30 @@
statusLoaded = !reload;
}
+/**
+ * Select a table or view using the provided name; returns YES if the
+ * supplied name could be selected, or NO if not.
+ */
+- (BOOL)selectTableOrViewWithName:(NSString *)theName
+{
+ int i, tableType, itemIndex = NSNotFound;
+
+ // Loop through the tables/views to find the desired item
+ for (i = 0; i < [tables count]; i++) {
+ tableType = [[tableTypes objectAtIndex:i] intValue];
+ if (tableType != SP_TABLETYPE_TABLE && tableType != SP_TABLETYPE_VIEW) continue;
+ if ([[tables objectAtIndex:i] isEqualToString:theName]) {
+ itemIndex = i;
+ break;
+ }
+ }
+
+ if (itemIndex == NSNotFound) return NO;
+
+ [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
+ return YES;
+}
+
#pragma mark Datasource methods
/**