/* SQLPanel.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.
 *
 * A simple panel to trace SQL queries generated by the Database Kit.
 *
 */

#import "SQLPanel.h"
#import	"ScrollViewExtras.h"

@implementation SQLPanel

- orderFront:sender
{
    [scrollView clear:self];
    [[[[NXApp mainWindow] delegate] database] setDelegate:self];
    [super orderFront:sender];
    return self;
}

- windowWillClose:sender
{
    [scrollView clear:self];
    [[[[NXApp mainWindow] delegate] database] setDelegate:nil];
    return self;
}

- (BOOL)db:aDb notificationFrom:anObject
     message:(const unsigned char *)message code:(int)code
{
    [scrollView sprintf:"(%d) %s\n", code, message];
    return YES;
}

- (BOOL)db:aDb willEvaluateString:(const unsigned char *)string
     usingBinder:aBinder
{
    [scrollView sprintf:"%s\n", string];
    return YES;
}

@end
