home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep (Enterprise)
/
OpenStepENTCD.toast
/
OEDEV
/
DEV.Z
/
ODBCColumn.h
< prev
next >
Wrap
Text File
|
1996-09-09
|
3KB
|
90 lines
/*
ODBCColumn.h
Copyright (c) 1996, NeXT Software, Inc.
All rights reserved.
*/
#import <EOAccess/EOAccess.h>
@class ODBCChannel;
// This class is used internally by the ODBC adaptor to maintain the state
// of the various column buffers which are needed to fetch data.
//
// This is the abstract class from which all column types descend. The
// concrete classes usually just overload initWithAttribute:channel:
// to setup the cType and fetchWithZone: to retrieve the data.
//
@interface ODBCColumn:NSObject
{
EOAttribute*_attribute; // Attribute for column
short _cType; // C language type
void * _value; // pointer to value buffer
long _valueLength; // length of value buffer
long _returnedLength; // returned length
unsigned _column; // associated column
void * _statement; // associated statment
NSStringEncoding _encoding;
ODBCChannel *_channel;
EOAdaptorValueType _adaptorValueType;
}
- initWithAttribute:(EOAttribute *)attribute channel:(ODBCChannel *)channel;
// This is the designated initializer for all ODBCColumns.
// Each column subclass must set _cType and _valueLength in their
// initWithAttribute: method.
-(void)allocateValue;
-(void)freeValue;
// Used internally to allocate memory to bind to.
// Fetch bindings
- (BOOL)couldBind;
// Default YES. LongByte columns returns NO.
- (void)connectToColumn:(unsigned)index ofStatement:(void *)statement useBinding:(BOOL)useBinding;
// If use binding is YES, call bindToColumn:ofStatement. If not,
// prepare the column to use SQLGetData.
- (void)bindToColumn:(unsigned)index ofStatement:(void *)statement;
// Called by the channel to allow the column to define the output buffers.
// Does the SQLBindColumn () to set up the buffers for fetching data.
// The instance variables _cType and _valueLength must be set up by
// the subclasses before getting here.
- (id)buildValueFromSQLValue:(const void *)value length:(unsigned)length zone:(NSZone *)zone;
// Use value to create the foundation oject returned by fetchWithZone
// Returns a **retained** object
- (id)fetchWithZone:(NSZone *)zone;
// This is the method which gets called to actually fetch data for a column
// Returns a **retained** object (caller must release) for performance
// reasons.
// If the column is 'binded' it just return the result of
// [self buildValueFromSQLValue:length:], if not it's fetching the data with
// SQLGetData before.
// Parameters bindings
- (void)bindAttribute:(EOAttribute *)attribute forInputColumn:(unsigned)column ofStatement:(void *)statement;
// Called by the channel to allow the column to define the input buffers.
- (void)takeInputValue:(id)value;
// Set the input value for a bind variable
// Used when passing IN bind variables
@end
@interface ODBCNumberColumn:ODBCColumn
@end
@interface ODBCDateColumn:ODBCColumn
@end
@interface ODBCByteColumn:ODBCColumn
@end
@interface ODBCLongByteColumn:ODBCByteColumn
@end