ftp.nice.ch/peanuts/GeneralData/Documents/developer/dbkit/AdaptorDocu.tar.gz#/AdaptorDocu/HeadersFromNext/DBBasicAdaptor.h

This is DBBasicAdaptor.h in view mode; [Download] [Up]

/*
**      DBBasicAdaptor.h
**      Database Kit, Release 3.0
**      Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved. 
*/

#import <objc/Object.h>
#import <dbkit/protocols.h>
#import <dbkit/customType.h>		


@class List, DBDatabase, DBBinder, NXBundle;

/*
** This is the class that all adaptors should inherit from.  Normally, many of
**  the default behaviors provided will be adequate.
**
** Most simple adaptors do not need to understand the following protocols --
**  they exist for people who need to generate their own special query
**  dialect, or who want to do complex runtime resource management.  A
**  simple adaptor need only implement a subset of the basic methods in
**  order to work -- minimally evaluateString:using: and, if data is returned,
**  fetchData:
**
** The expressionClass method returns the class used to generate query
**  language (if any). The default is a private class called DBSQLExpression;
**  see AdaptorNotes.rtf for a more detailed discussion of the requirements
**  for implementing a new query language.
**
** contextClass returns the class used by contextForObject:  The
**  default is nil -- which results in messages being sent directly to the
**  adaptor.  If the class method is overridden to return a factory
**  object, then the default behavior of DBBasicAdaptor will send the
**  following messages to the context, rather than to the adaptor:
**
** 	- (BOOL)evaluateString:(const unsigned char*)aString
**		using:(DBBinder*)aBinder;
**	- (BOOL)fetchData:(DBBinder*)aBinder;
**	- (BOOL)insertData:aBinder;
**	- (BOOL)selectData:aBinder;
**	- (BOOL)updateData:aBinder;
**	- (BOOL)deleteData:aBinder;
**
*/

@interface DBBasicAdaptor : Object <DBTransactions>
{
@public
  id bundle;
}

- initForDatabase:(DBDatabase*)aDatabase;
- (NXBundle*)bundle;

- (BOOL)connectUsingString:(const unsigned char*)aString;
- (BOOL)disconnectUsingString:(const unsigned char*)aString;
- (BOOL)isConnected;

- (BOOL)evaluateString:(const unsigned char*)aString using:(DBBinder*)aBinder;
- (BOOL)fetchData:(DBBinder*)aBinder;
- (void)fetchDone:(DBBinder*)aBinder;

- (BOOL)insertData:(DBBinder*)aBinder;
- (BOOL)selectData:(DBBinder*)aBinder;
- (BOOL)updateData:(DBBinder*)aBinder;
- (BOOL)deleteData:(DBBinder*)aBinder;

- (const unsigned char*)connectionName;
- (const unsigned char*)currentLoginString;

- (List*)enumerateEntities:(List*)aList;
- (List*)enumerateProperties:(List*)aList forEntity:(id<DBEntities>)anEntity;

/*
** Optional specialized support for ROWID and outer joins in relational
**  databases.
*/
- (id<DBProperties>)recordIdentityProperty;
- (BOOL)outerJoinIsDefault;

- (BOOL)maintainContexts:(BOOL)yn;
- contextForObject:anObject;
- releaseContextForObject:anObject;

- expressionClass;
- contextClass;

- (BOOL)isTransactionInProgress;
- (BOOL)enableTransactions:(BOOL)yn;
- (BOOL)areTransactionsEnabled;

@end

@interface DBBasicAdaptorContext : Object

- initForAdaptor:anAdaptor;

- (BOOL)evaluateString:(const unsigned char*)aString using:(DBBinder*)aBinder;
- (BOOL)fetchData:(DBBinder*)aBinder;

@end

/*
** This is used to read objects from database buffers --
**  If the property has a classname associated with it, and if that class
**  responds to the selector initFromBuffer:ofLength:withFormat:
**  then an object is allocated, that init method is invoked, and the
**  object is returned.
**
**  If the property has no format, then an attempt is made to
**  unarchive an object.  If there IS a format given, and there is
**  no class or the class does not respond to the message above, then a
**  default class may be used to allocate the object returned by the dbkit.
**  (For example, an  NXTIFFpboardType might return an NXImage by default.)
*/
extern id DBReadObject(void* buffer, unsigned length, id binder, id aProperty);

/*
** These are internationalization routines.  DBLocalizedStringForAdaptor() will
**  locate a string table with the name <adaptorname>.strings in an lproj
**  within the adaptor bundle.  Got that?  DBLocalizedNibForAdaptor will look
**  in the same place for a nibfile passed as a parameter.
*/
extern id DBLocalizedNibForAdaptor(const char *aNibFile, const char* aName);
extern const char *DBLocalizedStringForAdaptor(const char *key,
  			           const char *val, const char *aClassname);


These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.