File:  [NeXTSTEP 3.3 examples] / Examples / EnterpriseObjects / SQLExecutor / SybaseDelegate.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:48:42 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

/* SybaseDelegate.h:
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 *
 * Written by Dan Willhite, EO Dev Team
 * Modified by Mai Nguyen
 *
 */

#import "SybaseDelegate.h"
#import "Evaluator.h"

/* A way to get a string out of an object */

@implementation SybaseDelegate
- (NSArray *)sybaseChannel:(SybaseChannel *)channel
    willFetchAttributes:(NSArray *)attributes
    forRowOfType:(SybaseRowType)rowType
    withComputeRowId:(int)computeRowId
{
	currentRowType = rowType;
	
    if (rowType == SybaseRegularRow)
	return attributes;
	
    attributes = [(EOAdaptorChannel *) channel describeResults];
    return attributes;
}

/* Return YES will return all row types: regular, compute, etc.
 * If one only wants specific rows to be returned, one can selectively
 * return YES on those row types and NO on all others.
 */
- (BOOL)sybaseChannel:(SybaseChannel *)channel
    willReturnRow:(NSDictionary *)row ofType:(SybaseRowType)rowType 
    withComputeRowId:(int)computeRowId
{
	currentRowType = rowType;
	
    switch (rowType) {
	case SybaseRegularRow:
	    break;
	case SybaseComputeRow:
		[[[NXApp mainWindow] delegate] logString:@"Returning compute row\n"];
	    break;
	case SybaseReturnParameterRow:
		[[[NXApp mainWindow] delegate] logString:
							@"Returning return parameter row\n"];
	    break;
	case SybaseReturnStatusRow:
		[[[NXApp mainWindow] delegate] logString:
							@"Returning return status row\n"];
	    break;
    }
    
    return YES;
}

- (SybaseRowType) currentRowType
{
	return currentRowType;
}

- (void)adaptorChannelDidChangeResultSet:channel
{
    // Invoked from -fetchAttributes:withZone: to tell the delegate that
    // fetching will start for the next result set, when a select operation
    // resulted in multiple result sets.  This method is invoked just after a
    // -fetchAttributes:withZone: returns nil when there are still result sets
    // left to fetch.

	[[[NXApp mainWindow] delegate] announce:channel selector:_cmd];
}



- (void)adaptorChannel:channel
    didEvaluateExpression:(NSString *)expression
{
    // Invoked from -evaluateExpression: to tell the delegate that a query
    // language expression has been evaluated by the database server. The
    // delegate may take whatever action it needs based on this information.

	[[[NXApp mainWindow] delegate] announce:channel 
		selector:_cmd 
		with:[NSArray arrayWithObject:expression]];
}



@end


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.