ftp.nice.ch/pub/next/developer/objc/dbkit/BooleanFormatter.92.9.s.tar.gz#/BooleanFormatter/TableViewController.m

This is TableViewController.m in view mode; [Download] [Up]

/* TableViewController.m:
 * 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: Mai Nguyen, NeXT Developer Support
 *
 *
 */
#import "TableViewController.h"
#import "BooleanFormatter.h"

#define INSTALL_MODEL NXLocalizedString("Please install OracleDemo.dbmodel into your ~/Library/Databases directory and restart.", NULL, "Notify user that OracleDemo.dbmodel must be installed in his local Databases directory.")

@implementation TableViewController
/*
* Miscellaneous initialization tasks: connect to database, initialize
* tableview, set up dbModule. 
*/ 
-appDidInit:sender
{
	id vector;
		
	/* Notify the user if the database can't be found */
	if (!(dbDatabase = [DBDatabase findDatabaseNamed:"OracleDemo" 
					connect:YES])) {
		NXRunAlertPanel(NULL,INSTALL_MODEL, "OK", NULL, NULL);
		return self;
	}
	[dbDatabase setDelegate:self];
	
		/* Override the display of the boolean column */
	vector = [dbTableView columnAt:2];
	newFormatter = [[BooleanFormatter alloc] init];
	[vector setFormatter:newFormatter];
	return self;
}

- free
{
	if (newFormatter)
		[newFormatter free];
	return[super free];
}

/* DBDatabase delegate methods to log SQL queries  - Useful for debugging */

- (BOOL)db:aDb willEvaluateString:(const char*)aString usingBinder:aBinder
{
	fprintf(stderr, "SQL query:%s\n", aString);
	return YES;
}


@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.