home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEPLOY / ODBCAD.Z / ODBCColumn.h < prev    next >
Text File  |  1996-09-09  |  3KB  |  90 lines

  1. /*
  2.    ODBCColumn.h
  3.    Copyright (c) 1996, NeXT Software, Inc.
  4.    All rights reserved.
  5. */
  6.  
  7. #import <EOAccess/EOAccess.h>
  8.  
  9. @class ODBCChannel;
  10.  
  11. // This class is used internally by the ODBC adaptor to maintain the state
  12. // of the various column buffers which are needed to fetch data.
  13. //
  14. // This is the abstract class from which all column types descend. The
  15. // concrete classes usually just overload initWithAttribute:channel:
  16. // to setup the cType and fetchWithZone: to retrieve the data.
  17. //
  18. @interface ODBCColumn:NSObject
  19. {
  20.     EOAttribute*_attribute;        // Attribute for column
  21.     short    _cType;            // C language type
  22.     void *    _value;            // pointer to value buffer
  23.     long     _valueLength;        // length of value buffer
  24.     long     _returnedLength;    // returned length
  25.     unsigned     _column;            // associated column
  26.     void *    _statement;            // associated statment
  27.  
  28.     NSStringEncoding _encoding;
  29.     ODBCChannel *_channel;
  30.     EOAdaptorValueType _adaptorValueType;
  31. }
  32.  
  33. - initWithAttribute:(EOAttribute *)attribute channel:(ODBCChannel *)channel;
  34.     // This is the designated initializer for all ODBCColumns.
  35.     // Each column subclass must set _cType and _valueLength in their
  36.     // initWithAttribute: method.
  37.  
  38. -(void)allocateValue;
  39. -(void)freeValue;
  40.     // Used internally to allocate memory to bind to.
  41.  
  42. // Fetch bindings
  43. - (BOOL)couldBind;
  44.     // Default YES. LongByte columns returns NO.
  45.  
  46. - (void)connectToColumn:(unsigned)index ofStatement:(void *)statement useBinding:(BOOL)useBinding;
  47.     // If use binding is YES, call bindToColumn:ofStatement. If not,
  48.     // prepare the column to use SQLGetData.
  49.  
  50. - (void)bindToColumn:(unsigned)index ofStatement:(void *)statement;
  51.     // Called by the channel to allow the column to define the output buffers.
  52.     // Does the SQLBindColumn () to set up the buffers for fetching data.
  53.     // The instance variables _cType and _valueLength must be set up by
  54.     // the subclasses before getting here.
  55.  
  56. - (id)buildValueFromSQLValue:(const void *)value length:(unsigned)length zone:(NSZone *)zone;
  57.     // Use value to create the foundation oject returned by fetchWithZone
  58.     // Returns a **retained** object
  59.  
  60. - (id)fetchWithZone:(NSZone *)zone;
  61.     // This is the method which gets called to actually fetch data for a column
  62.     // Returns a **retained** object (caller must release) for performance
  63.     // reasons.
  64.     // If the column is 'binded' it just return the result of
  65.     // [self buildValueFromSQLValue:length:], if not it's fetching the data with
  66.     // SQLGetData before.
  67.  
  68. // Parameters bindings
  69. - (void)bindAttribute:(EOAttribute *)attribute forInputColumn:(unsigned)column ofStatement:(void *)statement;
  70.     // Called by the channel to allow the column to define the input buffers.
  71.  
  72. - (void)takeInputValue:(id)value;
  73.     // Set the input value for a bind variable
  74.     // Used when passing IN bind variables
  75.  
  76. @end
  77.  
  78. @interface ODBCNumberColumn:ODBCColumn
  79. @end
  80.  
  81. @interface ODBCDateColumn:ODBCColumn
  82. @end
  83.  
  84. @interface ODBCByteColumn:ODBCColumn
  85. @end
  86.  
  87. @interface ODBCLongByteColumn:ODBCByteColumn
  88. @end
  89.  
  90.