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

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

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

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

/*
** DBAttribute can be thought of as a "pointer to an external datum".  In
**  the context of a DBDataPath, it both knows where to find that datum,
**  and "how to speak the language" in order to retrieve its value(s).
**
** You can have a database manufacture DBAttributes for you, by using
**  its native query language and letting it specify the returned results,
**  if any.  You may also alloc and init your own attributes, or use
**  the attributes provided by a DBDatabase.  This last method is the one
**  to use if using the InterfaceBuilder to hook to a database.
**
** The associate: calls in the binder can be used to associate
**  the ivars or methods of an object with DBAttributes; this will cause the
**  type information in those attributes to reflect the types in the object 
**  or methods.
**
** Another useful thing about DBAttributes is that "data dictionary"
**  information is returned in them.  If you perform a selectNoFetch:, and
**  then examine the dataDescription, you will find that it describes the
**  results of the query, with both an external and an objc types.  It also
**  may have useful field length info, and will contain the names of fields
**  (in the event of a select *, let's say.)
**
** Since we are assuming the objective-C runtime system as our target typing
**  system, null values are handled using the "designated value" system rather
**  than the "indicator variable" system.  The designated null value is a
**  reserved value -- NULL, nil, MININT, or NaN (found in ansi/math.h).
**  Nulls will print as "" or zero, if not checked for.
*/

@interface DBAttribute : Object <DBProperties, DBTypes, DBExpressionValues>
{
  id entity;

@private
  id _propertyNameExpr;
  id _internalNameExpr;
  id _aliasedNameExpr;
  id _typeExpr;
  id _dbTypeExpr;

  const char *_classname;
  const char *_format;

  struct {
    BOOL aggregate:1;	/* attr is aggregate */
    BOOL readOnly:1;    /* is this attribute read only? */
    BOOL key:1;		/* is attr part of the primary key? */
    BOOL hidden:1;	/* is attr invisible in browsers? */
    int _RESERVED:12;
  } _flags;
}

+ initialize;

- initWithName:(const char*)aName andType:(const char*)type
    forEntity:(id<DBEntities>)anEntity;
- copyFromZone:(NXZone*)z;
- free;

- (BOOL)isAggregate;
- (BOOL)isHidden;

- setReadOnly:(BOOL)yn;
- setKey:(BOOL)yn;
- setAggregate:(BOOL)yn;
- setHidden:(BOOL)yn;

- (const char*)format;

- setDatabaseType:(const char*)aDBType;
- setFormat:(const char*)aFormat;

/*
** In order to produce aggregate or compound attributes, such as count(),
**  avg(), or emp.salary / emp.age in SQL, the _internalNameExpression of the
**  attribute must represent the string and the isAggregate flag MUST be set
**  to YES.  Please note that by replacing the _internalNameExpression with
**  an ExpressionList, multiple dataPaths can be embedded within the
**  "derived" attribute while preserving the automatic joining features of
**  a DataDictionary.
*/
- setInternalName:(const char*)newInternalName;
- (const char*)internalName;

- read:(NXTypedStream*)ts;
- write:(NXTypedStream*)ts;

@end

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