|
|
1.1 ! root 1: /* SybaseDelegate.h: ! 2: * You may freely copy, distribute, and reuse the code in this example. ! 3: * NeXT disclaims any warranty of any kind, expressed or implied, as to its ! 4: * fitness for any particular use. ! 5: * ! 6: * Written by Dan Willhite, EO Dev Team ! 7: * Modified by Mai Nguyen ! 8: * ! 9: */ ! 10: ! 11: #import "SybaseDelegate.h" ! 12: #import "Evaluator.h" ! 13: ! 14: /* A way to get a string out of an object */ ! 15: ! 16: @implementation SybaseDelegate ! 17: - (NSArray *)sybaseChannel:(SybaseChannel *)channel ! 18: willFetchAttributes:(NSArray *)attributes ! 19: forRowOfType:(SybaseRowType)rowType ! 20: withComputeRowId:(int)computeRowId ! 21: { ! 22: currentRowType = rowType; ! 23: ! 24: if (rowType == SybaseRegularRow) ! 25: return attributes; ! 26: ! 27: attributes = [(EOAdaptorChannel *) channel describeResults]; ! 28: return attributes; ! 29: } ! 30: ! 31: /* Return YES will return all row types: regular, compute, etc. ! 32: * If one only wants specific rows to be returned, one can selectively ! 33: * return YES on those row types and NO on all others. ! 34: */ ! 35: - (BOOL)sybaseChannel:(SybaseChannel *)channel ! 36: willReturnRow:(NSDictionary *)row ofType:(SybaseRowType)rowType ! 37: withComputeRowId:(int)computeRowId ! 38: { ! 39: currentRowType = rowType; ! 40: ! 41: switch (rowType) { ! 42: case SybaseRegularRow: ! 43: break; ! 44: case SybaseComputeRow: ! 45: [[[NXApp mainWindow] delegate] logString:@"Returning compute row\n"]; ! 46: break; ! 47: case SybaseReturnParameterRow: ! 48: [[[NXApp mainWindow] delegate] logString: ! 49: @"Returning return parameter row\n"]; ! 50: break; ! 51: case SybaseReturnStatusRow: ! 52: [[[NXApp mainWindow] delegate] logString: ! 53: @"Returning return status row\n"]; ! 54: break; ! 55: } ! 56: ! 57: return YES; ! 58: } ! 59: ! 60: - (SybaseRowType) currentRowType ! 61: { ! 62: return currentRowType; ! 63: } ! 64: ! 65: - (void)adaptorChannelDidChangeResultSet:channel ! 66: { ! 67: // Invoked from -fetchAttributes:withZone: to tell the delegate that ! 68: // fetching will start for the next result set, when a select operation ! 69: // resulted in multiple result sets. This method is invoked just after a ! 70: // -fetchAttributes:withZone: returns nil when there are still result sets ! 71: // left to fetch. ! 72: ! 73: [[[NXApp mainWindow] delegate] announce:channel selector:_cmd]; ! 74: } ! 75: ! 76: ! 77: ! 78: - (void)adaptorChannel:channel ! 79: didEvaluateExpression:(NSString *)expression ! 80: { ! 81: // Invoked from -evaluateExpression: to tell the delegate that a query ! 82: // language expression has been evaluated by the database server. The ! 83: // delegate may take whatever action it needs based on this information. ! 84: ! 85: [[[NXApp mainWindow] delegate] announce:channel ! 86: selector:_cmd ! 87: with:[NSArray arrayWithObject:expression]]; ! 88: } ! 89: ! 90: ! 91: ! 92: @end ! 93:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.