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

  1. /*
  2.    ODBCChannel.h
  3.    Copyright (c) 1996, NeXT Software, Inc.
  4.    All rights reserved.
  5. */
  6.  
  7. #import <EOAccess/EOAccess.h>
  8.  
  9. @interface ODBCChannel : EOAdaptorChannel
  10. {
  11.     void *_statement;                 // HSTMT
  12.     NSArray* _attributes;             // attributes for current expression
  13.     NSMutableArray *_selectedColumns; // columns for selected attributes
  14.     unsigned _rowsProcessedCount;     // number of rows processed thus far
  15.     struct {
  16.         unsigned int beganTransaction:1;
  17.         unsigned int fetchInProgress:1;
  18.         unsigned int :0;
  19.     } _flags;
  20. }
  21.  
  22. - initWithAdaptorContext:(EOAdaptorContext *)context;
  23.     // designated initializer. The channel expect an ODBC context.
  24.  
  25. - (BOOL)isOpen;
  26.     // Returns YES if the channel has been opened with -openChannel,
  27.     // NO if not.
  28.  
  29. - (void)openChannel;
  30.     // This method puts the channel and both its context and adaptor into a
  31.     // state where they are ready to perform database operations. Raises an
  32.     // exception if error occurs.
  33.  
  34. - (void)closeChannel;
  35.     // This method disconnects the channel, disconnects the channel's context
  36.     // if the context has no other channels open, and then disconnects the
  37.     // adaptor if it has no additional contexts open.
  38.  
  39. - (void)insertRow:(NSDictionary *)row forEntity:(EOEntity *)entity;
  40.     // Inserts the attributes of row into the database.  row is an
  41.     // NSDictionary whose keys are attribute names and whose values are the
  42.     // values that will be inserted. Raises an exception if error occurs.
  43.  
  44. - (unsigned)updateValues:(NSDictionary *)row inRowsDescribedByQualifier:(EOQualifier *)qualifier entity:(EOEntity *)entity;
  45.     // Updates the row described by qualifier so that its values are equal to
  46.     // those in the values dictionary.  The values dictionary contains a set
  47.     // of attribute name/value pairs. Returns the number of rows affected by
  48.     // this method. This method may raise an exception if an error occurs. 
  49.  
  50. - (unsigned)deleteRowsDescribedByQualifier:(EOQualifier *)qualifier entity:(EOEntity *)entity;
  51.     // Deletes the rows described by the qualifier. Returns the number of rows
  52.     // affected by this method. This method may raise an exception if an error
  53.     // occurs
  54.  
  55. - (void)selectAttributes:(NSArray *)attributes fetchSpecification:(EOFetchSpecification *)fetchSpec lock:(BOOL)yn entity:(EOEntity *)entity;
  56.     // Selects the given attributes in rows matching the qualifier. The
  57.     // selected rows compose one result set, each row of which will
  58.     // be returned by subsequent -fetchRowWithZone: messages according
  59.     // to the given fetchOrder (see EOSortOrdering.h).  If flag is YES,
  60.     // the rows are locked if possible so that no other user can modify them.
  61.     // This methods may raise an exception if an error occurs.
  62.  
  63. - (void)evaluateExpression:(EOSQLExpression *)expression;
  64.     // Sends expression to the database server for evaluation. This methods
  65.     // may raise an exception if an error occurs.
  66.  
  67. - (BOOL)isFetchInProgress;
  68.     // Returns YES if the adaptor channel is fetching, NO otherwise.  An
  69.     // adaptor channel is fetching if it's been sent a successful
  70.     // -selectAttributes:...  message, or if an expression sent through
  71.     // -evaluateExpression: resulted in a select.  An adaptor channel stops
  72.     // fetching when there are no more records to fetch or when it's sent
  73.     // a -cancelFetch message
  74.  
  75. - (NSArray *)describeResults;
  76.     // Returns an array of attributes describing the properties available in
  77.     // the current result set, as determined by -selectAttributes:...  or a
  78.     // select statement evaluated by -evaluateExpression:.
  79.     // This methods may raise an exception if an error occurs
  80.  
  81. - (NSMutableDictionary *)fetchRowWithZone:(NSZone *)zone;
  82.     // Fetches the next row from the result set of the last
  83.     // -selectAttributes:...  message and returns values for the attribute
  84.     // names in attributes.  When there are no more rows in the current result
  85.     // set, this method returns nil, and invokes the delegate method
  86.     // -adaptorChannelDidChangeResultSet: if there are more results sets.
  87.     // When there are no more rows or result sets, this method returns nil,
  88.     // ends the fetch, and invokes -adaptorDidFinishFetching:.
  89.     // -isFetchInProgress returns YES until the fetch is cancelled or until
  90.     // this method exhausts all result sets and returns nil.
  91.     // This methods may raise an exception if an error occurs.
  92.  
  93. - (void)setAttributesToFetch:(NSArray *)attributes;
  94.     // Allows the user to change the set of attributes used to describe the
  95.     // fetch data in the middle of a select. This method
  96.     // raises if invoked when there is no fetch in progress.
  97.  
  98. - (NSArray *)attributesToFetch;
  99.     // Returns the set of attributes used by the adaptor for a particular
  100.     // fetch.
  101.  
  102. - (void)cancelFetch;
  103.     // Clears the result set created by the last selectAttributes:...
  104.     // message, and terminates the current fetch, so that
  105.     // -isFetchInProgress returns NO.
  106.  
  107. - (NSDictionary *)primaryKeyForNewRowWithEntity:(EOEntity *)entity;
  108.     // try to returns a new primary key.
  109.     // Otherwise, returns nil.
  110.  
  111. - (NSArray *)describeTableNames;
  112.     // Reads and returns an array of table names from the database.  This
  113.     // method in conjunction with describeModelWithTableNames: is used for
  114.     // building a default model in EOModeler. This methods may raise an
  115.     // exception if an error occurs
  116.  
  117. - (EOModel *)describeModelWithTableNames:(NSArray *)tableNames;
  118.     // Constructs a default model out of the database's meta data.  It also
  119.     // put the adaptor name and connection dictionary in the new model.
  120.     // This methods may raise an exception if an error occurs.
  121.  
  122. // ODBC specific
  123. - (void *)odbcStatement;  // HSTMT
  124. - (NSDictionary *)odbcTypeInfo;
  125.     // Returns the result for SQLTypeInfo, nicely formatted in a dictionary
  126.     // ready to incorporate to a model file. Called from +getTypeInfoForModel
  127.     // on the ODBCAdaptor.
  128.  
  129. @end
  130.