#include <oofrel.h>
Inheritance diagram for dbRelRef:


mandatory dbField overrides | |
| virtual OOF_fieldTypes | fieldType () const |
| virtual unsigned long | fieldStorageLen () const |
reflective operations | |
| virtual bool | fieldIsSameTypeAs (const dbField *) const |
| virtual const OOF_String & | fieldName () const |
| Override to return related table name as sensible default. | |
| virtual void | describe (std::ostream &) const |
| Provide human-readable information about object. | |
| virtual void | extract (std::ostream &) const |
| virtual OOF_fieldTypes | nativeType () const |
| virtual bool | fieldIsVirtual () const |
| dbRelRefBase * | inverse () const |
| dbTable * | relatedTable () |
| tableNumT | relatedTableNumber () const |
| bool | isRef () const |
| Is "ref" to just one instance. | |
| virtual bool | pointsToCorrectTableType () const |
| Default base method. | |
simple user-level queries as to type of relationship | |
| bool | isOneToMany () const |
| bool | isManyToOne () const |
| bool | isOneToOne () const |
| bool | isManyToMany () const |
| bool | isJoin () const |
| If we don't have mJoinField then we are a pointer relationship. | |
| bool | isRelBackToParent () const |
| Do we point left or right? ie: in Patients->Visits is this relationship field pointing back from Visits to Patients (the inverse relationship). | |
perform the relationship traversal | |
| unsigned long | countAllRelated () |
| bool | relateRecord (bool broadcastChange=true) |
| bool | selectAllRelated (bool broadcastChange=true) |
| bool | relateFromRecord (bool broadcastChange=true) |
| Used to load a related selection. | |
relationship manipulation | |
| void | updateRelValue () |
| Propagate values to maintain a relationship. | |
| void | setOID (oidT) |
| void | breakRelLink () |
| Break the link from another table pointing at us. | |
| void | changeRelationshipTo (dbRelRefBase &newRhs) |
| Change an existing relationship to point to a different field. | |
Public Types | |
| enum | FieldIsStandaloneT { eFieldIsStandalone } |
| enum | { kKeyLengthAutoCalculated = USHRT_MAX } |
Public Member Functions | |
| dbRelRef (const char *fieldName=0) | |
| ctor allowing you to pass field name for relationship. | |
| virtual | ~dbRelRef () |
| dbRelRef (const dbRelRef &) | |
| const dbRelRef & | operator= (const dbRelRef &) |
| dbQueryBinary | nullRelationship () const |
| Search expression to find records which have a relationship pointing nowhere. | |
| bool | setRelatedRecord (oidT) |
| Set our link to a single record to the specified OID. | |
| bool | setRelatedRecord (dbTable *) |
| Set our link to a single record to the specified record. | |
| bool | setRelatedRecordMatching (const dbQueryClause &) |
| Set our link to a single record found by the search expression. | |
| virtual dbField * | clone () const |
| virtual void | postCloneTableCleanup () |
| void | completeCloneOfInverse (dbRelRefBase *cloner) |
| void | completeCloneOfInverse (dbTable *clonerTable) |
| void | setMNlink (OOF_RelMN *) |
| Point this relationship at the object which maintains the link. | |
| OOF_RelMN * | getMNlink () const |
| void | relatesTo (dbRelRefBase &) |
| Called by dbRelationship to tie two instances of dbRelRefBase together. | |
| void | joinField (dbField &) |
| dbField * | joinField () const |
| bool | propagatesDeletes () const |
| void | propagateRelatedDeletes (bool prop=true) |
| Set relationship to propagate deletes, ie: owns related records. | |
| virtual bool | receiveMsg (OOFmsgT msg, unsigned long senderDefined) |
| The default receiveMsg behaviour is to delete yourself when the broadcaster closes. | |
| virtual oofString | name () const |
| void | index (const OOF_IndexOptions=kIndexed) |
| void | indexPartialKeyLen (unsigned short) |
| void | setName (const char *name) |
| bool | hasDefaultCalculator () const |
| void | useCalculatorOnlyForDefaults () |
| bool | storesCalculatedValues () const |
| void | storeCalculatedValues () |
| bool | usingCalculator () const |
| const char * | tableName () const |
| bool | fieldIsStandalone () const |
| virtual unsigned long | fieldMinWrapWidth () const |
| virtual unsigned long | fieldUsualWrapWidth () const |
| dbTable * | fieldTable () const |
| unsigned long | fieldDataLen () const |
| virtual bool | isEmpty () const |
| bool | isDirty () const |
| fieldNumT | fieldNumber () const |
| OOF_IndexOptions | fieldIndexOptions () const |
| bool | fieldIndexIgnoresNulls () const |
| bool | fieldIndexIsCompressLeading () const |
| bool | fieldIndexIsCompressPadding () const |
| virtual bool | fieldIsIndexed () const |
| bool | fieldIsPartiallyIndexed () const |
| virtual bool | fieldIsKeywordIndexed () const |
| virtual bool | fieldIsUniqueIndexed () const |
| unsigned short | fieldNumIndexes () const |
| unsigned short | fieldKeyLen () const |
| bool | caseSensitive () const |
| virtual bool | fieldIsBlob () const |
| virtual bool | fieldIsBinary () const |
| dbField * | equivalentFieldFromTable (dbTable *) const |
| bool | valueIsDuplicate () const |
| virtual dbQueryClause * | valueAsQueryLiteral () const |
| bool | fieldIsJoinKey () const |
| Checks if any relationships in field's table use field as join key. | |
| virtual void | clear () |
| virtual void | setString (const char *) |
| virtual void | setNumber (long) |
| virtual oofString | copyString () const |
| virtual void | getChars (char *ioBuff, unsigned long &outLen) const |
| virtual const char * | asChars () const |
| virtual bool | insert (std::istream &, char fieldSep, char recSep) |
| virtual void | copyValueFrom (const dbField *) |
| virtual void | copyValueIfDifferent (const dbField *) |
| virtual bool | validateContents () |
| virtual oofWordParser * | words () const |
| void | saveDefaultCalculatedValue () |
| void | saveStoredCalculatedValue () |
| virtual void | generateTestData (bool, unsigned long) |
| bool | hidden () const |
| void | hide (bool hideIt=true) |
| virtual void | subscribeTo (oofBroadcaster *) |
| virtual void | unsubscribe (oofBroadcaster *from=0) |
| void | suspendListening () |
| void | resumeListening () |
Protected Member Functions | |
| unsigned long | CountAllRelatedIn (dbTable *) |
| void | BuildRelatedTable () |
| bool | CompletelySpecified () const |
| void | SetCommonRelationshipFields (dbRelRefBase &) |
| oidT | OID () const |
| void | OID (oidT) |
| void | CalculateWith (dbCalculator *adoptedCalculator, bool useOnlyForDefaults) |
| virtual void | CopyCalculatedValueToBuffer () |
Protected Attributes | |
| dbTable * | mCachedSearchTable |
| unsigned long | mMinLinks |
| unsigned long | mMaxLinks |
| dbTable * | mRelatedTableProto |
| dbTable * | mActualRelatedTable |
| fieldNumT | mInverseFieldNumber |
| dbField * | mJoinField |
| bool | mPropagatesDeletes |
| dbRelRefBase * | mInverseField |
| OOF_RelMN * | mMNlink |
| OOF_tableBackend * | mBackend |
| dbTable * | mTable |
| fieldNumT | mFieldNumber |
| dbCalculator * | mCalculator |
| bool | mHidden |
| oofBroadcaster * | mListensTo |
| oofBroadcaster * | mSuspendedListensTo |
| unsigned short | mSuspendCount |
|
|
|
|
|
|
|
|
ctor allowing you to pass field name for relationship. Inits dbRelRefBase with limit of only 1 related value allowed. |
|
|
|
|
|
|
|
|
|
|
|
Break the link from another table pointing at us. Doesn't need to do anything for join relationships as we deem it too dangerous to go and blithely clear key fields which may have multiple uses. Called when update record on rhs OR when reassign link
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
Reimplemented in dbChar, dbText, dbFixedBinary, and dbNumericField. |
|
|
Implements dbField. |
|
|
|
|
|
|
|
|
|
|
|
Reimplemented in dbChar, dbText, dbShort, dbUshort, dbBool, dbLong, dbUlong, dbReal, dbDate, dbTime, and dbDateTime. |
|
|
|
|
|
Reimplemented in dbChar, dbText, dbShort, dbUshort, dbBool, dbLong, dbUlong, dbReal, dbDate, dbTime, and dbDateTime. |
|
|
Reimplemented in dbChar, dbText, dbShort, dbUshort, dbBool, dbLong, dbUlong, dbReal, dbDate, dbTime, and dbDateTime. |
|
|
|
|
|
|
|
|
Provide human-readable information about object. Overriden to provide much more detail particularly for dbTable::describe() which provides full schema. Reimplemented from dbField. |
|
|
|
|
|
Reimplemented from dbField. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented in dbBLOB. |
|
|
|
|
|
Checks if any relationships in field's table use field as join key. Relatively expensive because it's iterating over all fields but all the function calls below are inline queries so will compile down well in release mode. WARNING Doesn't fan out - if any other tables use this field as a join key then they are doing really weird stuff and the application programmer must add their own checks. This feature originally added to support OOF_repEditSetupVisitor::VisitViewBandBody |
|
|
|
|
|
|
|
|
Reimplemented from dbField. |
|
|
|
|
|
|
|
|
Reimplemented from dbField. |
|
|
|
|
|
Reimplemented in dbNumericField. |
|
|
Override to return related table name as sensible default. Usually we don't bother naming individual relationships however you are able to call setName or pass in a name to the ctor. When modelling more than one relationship between the same classes we recommend naming the relationship variables.
Reimplemented from dbField. |
|
|
|
|
|
|
|
|
Implements dbField. |
|
|
|
|
|
Implements dbField. |
|
|
|
|
||||||||||||
|
Reimplemented in dbChar, dbBLOB, dbText, dbFixedBinary, dbShort, dbUshort, dbBool, dbLong, dbUlong, dbReal, dbDate, dbTime, and dbDateTime. |
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
Reimplemented in dbChar, dbText, dbShort, dbUshort, dbBool, dbLong, dbUlong, dbReal, dbDate, dbTime, and dbDateTime. |
|
|
|
|
|
Reimplemented in dbBLOB. |
|
|
Reimplemented in dbChar, dbBLOB, dbDate, and dbDateTime. |
|
|
If we don't have mJoinField then we are a pointer relationship. (or some other kind added later than OOFILE 1.4) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Is "ref" to just one instance.
|
|
|
Do we point left or right? ie: in Patients->Visits is this relationship field pointing back from Visits to Patients (the inverse relationship). This is important to know if you are following a relationship chain back from a related table to the source. So we test if the table which contains this field actually points back to the LHS via this field. |
|
|
|
|
|
|
|
|
Reimplemented from OOF_PublicBase. |
|
|
Reimplemented from dbField. |
|
|
Search expression to find records which have a relationship pointing nowhere. Pointer relationships on the rhs of a 1:something relationship store the OID of their related record, for direct lookup. Sample ooftst46 uses this to search for the Root of a tree, being something with no Parent. For the current record
|
|
|
|
|
|
|
|
|
|
|
|
Default base method. Macro REL_REF_BODY in oofmacro.h defines virtual overrides for each subclass that do an actual test using the macro-generated dbTable::defaultName() override.
|
|
|
Reimplemented from dbField. |
|
|
Set relationship to propagate deletes, ie: owns related records.
|
|
|
|
|
||||||||||||
|
The default receiveMsg behaviour is to delete yourself when the broadcaster closes. In many user subclasses oofSingleListener is a mixin and you have a class owned elsewhere, not self-deleting.
Reimplemented from oofSingleListener. |
|
|
|
|
|
|
|
|
Used to load a related selection. Mainly called from dbTable::ensureRecordLoaded and dbTable::MakeTableValid. It may seem a little backwards but think of the normal context of using this method. We have already loaded a current record in the LHS of a relationship and now want the related record or selection. Remember that OOFILE allows you to iterate a table without forcing instantiation of relationships. Only when you refer to a related selection or specific fields in a related record is the relationship instantiated. There are three distinct cases dealt with by this method:
If mInverseField (ie: other side of relationship pointing to us) isRef() then it contains a copy of the OID of a record in our table and we have a direct lookup (not caring if this is 1:1 or N:1 situation). Otherwise it is 1:N and the OID on the other side is its record's OID, used as a key to search our relationship fields.
|
|
|
|
|
|
Called by dbRelationship to tie two instances of dbRelRefBase together. Makes an actual relationship occur between the known tables in a dbConnection, finishing the work of declaring dbRelRef or dbRelSet members in the tables. Sets the relational integrity up by default to make sense for Western users. The left table owns the right table unless the relationship is back to front. ie: an N:1 doesn't propagate deletes. Assumes ctor initialises mPropagatesDeletes false. If you have explicitly set mPropagatesDeletes true already it will retain that setting. At this level we are working with the virtual and base methods of the dbRelRefBase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Point this relationship at the object which maintains the link. Calling setMNlink completes specifying the relationship - we assume the OOF_RelMN class manages the other relationships used to provide the 1:N N:1 that implement the M:N.
|
|
|
|
|
|
|