Kexi API Documentation (2.0 alpha)

KexiDB::Relationship Class Reference

#include <relationship.h>

List of all members.

Public Types

typedef QPtrList< RelationshipList
typedef QPtrListIterator<
Relationship
ListIterator

Public Member Functions

 Relationship ()
 Relationship (IndexSchema *masterIndex, IndexSchema *detailsIndex)
virtual ~Relationship ()
IndexSchemamasterIndex () const
IndexSchemadetailsIndex () const
Field::PairListfieldPairs ()
bool isEmpty () const
TableSchemamasterTable () const
TableSchemadetailsTable () const
void setIndices (IndexSchema *masterIndex, IndexSchema *detailsIndex)

Protected Member Functions

 Relationship (QuerySchema *query, Field *field1, Field *field2)
void createIndices (QuerySchema *query, Field *field1, Field *field2)
void setIndices (IndexSchema *masterIndex, IndexSchema *detailsIndex, bool ownedByMaster)

Protected Attributes

IndexSchemam_masterIndex
IndexSchemam_detailsIndex
Field::PairList m_pairs
bool m_masterIndexOwned: 1
bool m_detailsIndexOwned: 1

Friends

class Connection
class TableSchema
class QuerySchema
class IndexSchema


Member Typedef Documentation

typedef QPtrList<Relationship> KexiDB::Relationship::List
 

Definition at line 80 of file relationship.h.

typedef QPtrListIterator<Relationship> KexiDB::Relationship::ListIterator
 

Definition at line 81 of file relationship.h.


Constructor & Destructor Documentation

Relationship::Relationship  ) 
 

Creates uninitialized Relationship object. setIndices() will be required to call.

Definition at line 31 of file relationship.cpp.

References m_pairs.

Relationship::Relationship IndexSchema masterIndex,
IndexSchema detailsIndex
 

Creates Relationship object and initialises it just by calling setIndices(). If setIndices() failed, object is still uninitialised.

Definition at line 40 of file relationship.cpp.

References m_pairs, and setIndices().

Relationship::~Relationship  )  [virtual]
 

Definition at line 60 of file relationship.cpp.

References m_detailsIndex, m_detailsIndexOwned, m_masterIndex, and m_masterIndexOwned.

Relationship::Relationship QuerySchema query,
Field field1,
Field field2
[protected]
 

Definition at line 50 of file relationship.cpp.

References createIndices(), and m_pairs.


Member Function Documentation

void Relationship::createIndices QuerySchema query,
Field field1,
Field field2
[protected]
 

Definition at line 68 of file relationship.cpp.

References KexiDB::IndexSchema::addField(), IndexSchema, KexiDB::Field::isPrimaryKey(), KexiDB::Field::isQueryAsterisk(), KexiDBWarn, m_detailsIndex, m_detailsIndexOwned, m_masterIndex, m_masterIndexOwned, KexiDB::IndexSchema::setForeignKey(), setIndices(), KexiDB::IndexSchema::table(), and KexiDB::Field::table().

Referenced by Relationship().

IndexSchema* KexiDB::Relationship::detailsIndex  )  const [inline]
 

Returns:
index defining referenced side of this relationship. or null if there is no information defined.

Definition at line 101 of file relationship.h.

Referenced by KexiDB::IndexSchema::attachRelationship(), and KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal().

TableSchema * Relationship::detailsTable  )  const
 

Returns:
table assigned at "details / many / foreign" side of this relationship. or null if there is no information defined.

Definition at line 145 of file relationship.cpp.

References m_detailsIndex, and KexiDB::IndexSchema::table().

Field::PairList* KexiDB::Relationship::fieldPairs  )  [inline]
 

Returns:
ordered list of field pairs -- alternative form for representation of relationship or null if there is no information defined. Each pair has a form of <master-side-field, details-side-field>.

Definition at line 106 of file relationship.h.

Referenced by KexiDB::Connection::selectStatement().

bool KexiDB::Relationship::isEmpty  )  const [inline]
 

Definition at line 108 of file relationship.h.

Referenced by KexiDB::QuerySchema::addRelationship().

IndexSchema* KexiDB::Relationship::masterIndex  )  const [inline]
 

Returns:
index defining master side of this relationship or null if there is no information defined.

Definition at line 97 of file relationship.h.

Referenced by KexiDB::IndexSchema::attachRelationship(), and KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal().

TableSchema * Relationship::masterTable  )  const
 

Returns:
table assigned at "master / one" side of this relationship. or null if there is no information defined.

Definition at line 140 of file relationship.cpp.

References m_masterIndex, and KexiDB::IndexSchema::table().

void Relationship::setIndices IndexSchema masterIndex,
IndexSchema detailsIndex,
bool  ownedByMaster
[protected]
 

Internal version of setIndices(). ownedByMaster parameter is passed to IndexSchema::attachRelationship()

Definition at line 155 of file relationship.cpp.

References KexiDB::IndexSchema::attachRelationship(), KexiDB::Driver::defaultSQLTypeName(), KexiDB::FieldList::fieldCount(), KexiDB::FieldList::fields(), KexiDB::Field::isIntegerType(), KexiDB::Field::isTextType(), KexiDB::Field::isUnsigned(), KexiDBWarn, m_detailsIndex, m_masterIndex, m_pairs, KexiDB::Field::name(), KexiDB::IndexSchema::table(), and KexiDB::Field::type().

void Relationship::setIndices IndexSchema masterIndex,
IndexSchema detailsIndex
 

Sets masterIndex and detailsIndex indices for this relationship. This also sets information about tables for master- and details- sides. Notes:

  • both indices must contain the same number of fields
  • both indices must not be owned by the same table, and table (owner) must be not null.
  • corresponding field types must be the same
  • corresponding field types' signedness must be the same If above rules are not fulfilled, information about this relationship is cleared. On success, this Relationship object is detached from previous IndexSchema objects that were assigned before, and new are attached.

Definition at line 150 of file relationship.cpp.

Referenced by createIndices(), and Relationship().


Friends And Related Function Documentation

friend class Connection [friend]
 

Definition at line 148 of file relationship.h.

friend class IndexSchema [friend]
 

Definition at line 151 of file relationship.h.

Referenced by createIndices().

friend class QuerySchema [friend]
 

Definition at line 150 of file relationship.h.

friend class TableSchema [friend]
 

Definition at line 149 of file relationship.h.


Member Data Documentation

IndexSchema* KexiDB::Relationship::m_detailsIndex [protected]
 

Definition at line 141 of file relationship.h.

Referenced by createIndices(), detailsTable(), setIndices(), and ~Relationship().

bool KexiDB::Relationship::m_detailsIndexOwned [protected]
 

Definition at line 146 of file relationship.h.

Referenced by createIndices(), and ~Relationship().

IndexSchema* KexiDB::Relationship::m_masterIndex [protected]
 

Definition at line 140 of file relationship.h.

Referenced by createIndices(), masterTable(), setIndices(), and ~Relationship().

bool KexiDB::Relationship::m_masterIndexOwned [protected]
 

Definition at line 145 of file relationship.h.

Referenced by createIndices(), and ~Relationship().

Field::PairList KexiDB::Relationship::m_pairs [protected]
 

Definition at line 143 of file relationship.h.

Referenced by Relationship(), and setIndices().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:50:48 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003