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

  1. // InformixColumn.h
  2. // Copyright (c) 1994, NeXT Software, Inc.  All rights reserved.
  3. //
  4.  
  5. #import <EOAccess/EOAccess.h>
  6. #import "InformixSQLExpression.h"
  7.  
  8. // This class is used internally by the Informix adaptor to maintain the state
  9. // of the various column buffers which are needed to fetch data.
  10.  
  11. // These are the codes for the external (in the client) Informix data types.
  12. // InformixClientTypes specify how OCI should convert the data from the rdbms
  13. // into a form that can be consumed by the adaptor, or to describe the format
  14. // of of data passed into OCI by the adaptor.  Not all of these are used by
  15. // the current implementation, but are included here for completeness.
  16.  
  17. typedef enum
  18. {
  19.     EsqlCHAR    = 100,
  20.         EsqlFIXCHAR    = 108,
  21.         EsqlSTRING    = 109,
  22.         EsqlSMINT    = 101,
  23.         EsqlINT        = 102,
  24.         EsqlLONG    = 103,
  25.         EsqlFLOAT    = 105,
  26.         EsqlSMFLOAT    = 104,
  27.         EsqlDECIMAL    = 107,
  28.         EsqlSERIAL    = 103,
  29.         EsqlDATE    = 110,
  30.         EsqlMONEY    = 111,
  31.         EsqlDTIME    = 112,
  32.         EsqlLOCATOR    = 113,
  33.         EsqlVCHAR    = 114,
  34.         EsqlINTERVAL    = 115
  35. }       InformixClientType;
  36.  
  37. @class InformixChannel;
  38.  
  39. @interface InformixColumn:NSObject
  40. {
  41.     NSString *_attributeName;
  42.     EOAttribute *_attribute;
  43.  
  44.     NSStringEncoding _encoding;
  45.     EOAdaptorValueType _adaptorValueType;
  46.  
  47.     short *_indicator;
  48.     char *_columnBuffer;
  49.  
  50.     InformixClientType _clientType;
  51.     int _columnLength;
  52. }
  53.  
  54. + (NSString *)nameForInformixServerType:(InformixServerType)type;
  55.     // For a given informix data type, return the name of the type
  56.  
  57. + formatAttribute:(EOAttribute *)attribute;
  58.  
  59. + (EOAttribute *)attributeWithName:(NSString *)name
  60.     columnName:(NSString *)columnName externalType:(NSString *)dbType
  61.     externalLength:(int)dbLength precision:(int)precision scale:(int)scale
  62.     nullable:(BOOL)nullable;;
  63.     // Builds an EOAttribute based on the standard set of information
  64.     // available in Informix 5.00 about database columns.  This is called from
  65.     // attributeAtPosition:cursor: and by the describe routines.
  66.  
  67. + (EOAttribute *)attributeAtPosition:(int)position 
  68.     cursor:(struct informix_cursor *)cursor;
  69.     // Build an attribute for the item at "position" in the select list.
  70.     // Position indices start at 0.
  71.  
  72. - initWithAttribute:(EOAttribute *)attribute channel:(InformixChannel *)channel;
  73.     // Each column subclass must set _clientType and _columnLength in their
  74.     // initWithAttribute: method.
  75.  
  76. - (int)columnLength;
  77.     // This is a simple accessor for the _columnLength ivar.
  78.  
  79. - (BOOL)defineWithCursor:(struct informix_cursor *)cursor 
  80.     selectPosition:(unsigned)index 
  81.     rowCapacity:(unsigned)capacity;
  82.     // Does the infcol () to set up the buffers for fetching data and getting
  83.     // the various return codes.  The instance variables _clientType and
  84.     // _columnLength must be set up by the subclasses before getting here.
  85.  
  86. // The following methods are the ones which InformixColumn subclasses need to
  87. // implement to work with the rest of the adaptor.
  88.  
  89. - (BOOL)canUseArrayFetching;
  90.     // By default this returns YES.  Subclasses should return NO if they cannot
  91.     // use Informix's array fetching API.
  92.  
  93. - fetchFromIndex:(unsigned)index zone:(NSZone *)zone;
  94.     // This is the method which gets called to actually fetch data into a row.
  95.  
  96. @end
  97.  
  98.