KDbQueryAsterisk

Search for usage in LXR

#include <KDbQueryAsterisk.h>

Inheritance diagram for KDbQueryAsterisk:

Public Member Functions

 KDbQueryAsterisk (const KDbQueryAsterisk &asterisk)
 
 KDbQueryAsterisk (KDbQuerySchema *query)
 
 KDbQueryAsterisk (KDbQuerySchema *query, const KDbTableSchema &table)
 
bool isAllTableAsterisk () const
 
bool isSingleTableAsterisk () const
 
bool operator!= (const KDbQueryAsterisk &other) const
 
bool operator== (const KDbQueryAsterisk &other) const
 
KDbQuerySchemaquery ()
 
const KDbQuerySchemaquery () const
 
void setTable (const KDbTableSchema *table)
 
const KDbTableSchematable () const
 
- Public Member Functions inherited from KDbField
 KDbField ()
 
 KDbField (const KDbField &f)
 
 KDbField (const QString &name, Type type, Constraints constr=NoConstraints, Options options=NoOptions, int maxLength=0, int precision=0, const QVariant &defaultValue=QVariant(), const QString &caption=QString(), const QString &description=QString())
 
 KDbField (KDbTableSchema *tableSchema)
 
QString caption () const
 
QString captionOrName () const
 
Constraints constraints () const
 
CustomPropertiesMap customProperties () const
 
QVariant customProperty (const QByteArray &propertyName, const QVariant &defaultValue=QVariant()) const
 
QVariant defaultValue () const
 
QString description () const
 
QString enumHint (int num)
 
QVector< QStringenumHints () const
 
KDbExpression expression ()
 
const KDbExpression expression () const
 
bool hasEmptyProperty () const
 
bool isAutoIncrement () const
 
bool isAutoIncrementAllowed () const
 
bool isDateTimeType () const
 
bool isExpression () const
 
bool isForeignKey () const
 
bool isFPNumericType () const
 
bool isIndexed () const
 
bool isIntegerType () const
 
bool isNotEmpty () const
 
bool isNotNull () const
 
bool isNumericType () const
 
bool isPrimaryKey () const
 
bool isQueryAsterisk () const
 
bool isTextType () const
 
bool isUniqueKey () const
 
bool isUnsigned () const
 
int maxLength () const
 
MaxLengthStrategy maxLengthStrategy () const
 
QString name () const
 
Options options () const
 
int order () const
 
KDbFieldListparent ()
 
const KDbFieldListparent () const
 
int precision () const
 
KDbQuerySchemaquery ()
 
const KDbQuerySchemaquery () const
 
int scale () const
 
void setAutoIncrement (bool a)
 
void setCaption (const QString &caption)
 
void setConstraints (Constraints c)
 
void setCustomProperty (const QByteArray &propertyName, const QVariant &value)
 
bool setDefaultValue (const QByteArray &def)
 
void setDefaultValue (const QVariant &def)
 
void setDescription (const QString &description)
 
void setEnumHints (const QVector< QString > &hints)
 
void setExpression (const KDbExpression &expr)
 
void setForeignKey (bool f)
 
void setIndexed (bool s)
 
void setMaxLength (int maxLength)
 
void setMaxLengthStrategy (MaxLengthStrategy strategy)
 
void setName (const QString &name)
 
void setNotEmpty (bool n)
 
void setNotNull (bool n)
 
void setOptions (Options options)
 
void setPrecision (int p)
 
void setPrimaryKey (bool p)
 
void setQuery (KDbQuerySchema *query)
 
void setScale (int s)
 
void setSubType (const QString &subType)
 
void setTable (KDbTableSchema *table)
 
void setType (Type t)
 
void setUniqueKey (bool u)
 
void setUnsigned (bool u)
 
void setVisibleDecimalPlaces (int p)
 
QString subType () const
 
KDbTableSchematable ()
 
const KDbTableSchematable () const
 
Type type () const
 
TypeGroup typeGroup () const
 
QString typeGroupName () const
 
QString typeGroupString () const
 
QString typeName () const
 
QString typeString () const
 
QVariant::Type variantType () const
 
int visibleDecimalPlaces () const
 

Protected Member Functions

 KDbQueryAsterisk (KDbQuerySchema *query, const KDbTableSchema *table)
 
KDbFieldcopy () override
 
- Protected Member Functions inherited from KDbField
 KDbField (KDbFieldList *aParent, int aOrder=-1)
 
 KDbField (KDbQuerySchema *querySchema)
 
 KDbField (KDbQuerySchema *querySchema, const KDbExpression &expr)
 
void setOrder (int order)
 
void setParent (KDbFieldList *parent)
 

Additional Inherited Members

- Public Types inherited from KDbField
enum  Constraint {
  NoConstraints = 0 , AutoInc = 1 , Unique = 2 , PrimaryKey = 4 ,
  ForeignKey = 8 , NotNull = 16 , NotEmpty = 32 , Indexed = 64
}
 
typedef QFlags< ConstraintConstraints
 
typedef QHash< QByteArray, QVariantCustomPropertiesMap
 
typedef KDbUtils::AutodeletedList< KDbField * > List
 
typedef QList< KDbField * >::ConstIterator ListIterator
 
enum  MaxLengthStrategy { DefaultMaxLength , DefinedMaxLength }
 
enum  Option { NoOptions = 0 , Unsigned = 1 }
 
typedef QFlags< OptionOptions
 
typedef QPair< KDbField *, KDbField * > Pair
 
typedef QList< PairPairList
 
enum  Type {
  InvalidType = 0 , Byte = 1 , FirstType = 1 , ShortInteger = 2 ,
  Integer = 3 , BigInteger = 4 , Boolean = 5 , Date = 6 ,
  DateTime = 7 , Time = 8 , Float = 9 , Double = 10 ,
  Text = 11 , LongText = 12 , BLOB = 13 , LastType = 13 ,
  Null = 128 , Asterisk = 129 , Enum = 130 , Map = 131 ,
  Tuple = 132 , LastSpecialType = Tuple
}
 
enum  TypeGroup {
  InvalidGroup = 0 , TextGroup = 1 , IntegerGroup = 2 , FloatGroup = 3 ,
  BooleanGroup = 4 , DateTimeGroup = 5 , BLOBGroup = 6 , LastTypeGroup = 6
}
 
typedef QVector< KDbField * > Vector
 
- Static Public Member Functions inherited from KDbField
static QVariant convertToType (const QVariant &value, Type type)
 
static int defaultMaxLength ()
 
static bool hasEmptyProperty (Type type)
 
static bool isAutoIncrementAllowed (Type type)
 
static bool isDateTimeType (Type type)
 
static bool isFPNumericType (Type type)
 
static bool isIntegerType (Type type)
 
static bool isNumericType (Type type)
 
static bool isTextType (Type type)
 
static void setDefaultMaxLength (int maxLength)
 
static int specialTypesCount ()
 
static Type typeForString (const QString &typeString)
 
static TypeGroup typeGroup (Type type)
 
static TypeGroup typeGroupForString (const QString &typeGroupString)
 
static QString typeGroupName (TypeGroup typeGroup)
 
static QStringList typeGroupNames ()
 
static int typeGroupsCount ()
 
static QString typeGroupString (TypeGroup typeGroup)
 
static QString typeName (Type type)
 
static QStringList typeNames ()
 
static int typesCount ()
 
static QString typeString (Type type)
 
static QVariant::Type variantType (Type type)
 

Detailed Description

KDbQueryAsterisk class encapsulates information about single asterisk in query definition.

There are two types of query asterisks:

  1. "Single-table" asterisk, that references all fields of given table used in the query. Example SQL statement:
    SELECT staff.*, cars.model from staff, cars WHERE staff.car = cars.number;
    The "staff.*" element is our "single-table" asterisk; this tells us that we want to get all fields of table "staff".
  2. "All-tables" asterisk, that references all fields of all tables used in the query. Example SQL statement:
    SELECT * from staff, cars WHERE staff.car = cars.number;
    The "*" is our "all-tables" asterisk; this tells us that we want to get all fields of all used tables (here: "staff" and "cars").

There can be many asterisks of 1st type defined for given single query. There can be one asterisk of 2nd type defined for given single query.

Definition at line 50 of file KDbQueryAsterisk.h.

Constructor & Destructor Documentation

◆ KDbQueryAsterisk() [1/4]

KDbQueryAsterisk::KDbQueryAsterisk ( KDbQuerySchema * query)
explicit

Constructs an "all-tables" query asterisk definition object ("*" in SQL notation).

KDbQueryAsterisk objects are owned by KDbQuerySchema object (not by KDbTableSchema object like for ordinary KDbField objects) for that the KDbQueryAsterisk object was added (using KDbQuerySchema::addField()).

Definition at line 35 of file KDbQueryAsterisk.cpp.

◆ KDbQueryAsterisk() [2/4]

KDbQueryAsterisk::KDbQueryAsterisk ( KDbQuerySchema * query,
const KDbTableSchema & table )

Constructs a "single-table" query asterisk definition object ("T.*" in SQL notation). table schema is the single table for the asterisk.

KDbQueryAsterisk objects are owned by KDbQuerySchema object (not by KDbTableSchema object like for ordinary KDbField objects) for that the KDbQueryAsterisk object was added (using KDbQuerySchema::addField()).

Definition at line 40 of file KDbQueryAsterisk.cpp.

◆ KDbQueryAsterisk() [3/4]

KDbQueryAsterisk::KDbQueryAsterisk ( const KDbQueryAsterisk & asterisk)

Constructs a deep copy of query asterisk definition object asterisk.

Definition at line 52 of file KDbQueryAsterisk.cpp.

◆ ~KDbQueryAsterisk()

KDbQueryAsterisk::~KDbQueryAsterisk ( )
override

Definition at line 58 of file KDbQueryAsterisk.cpp.

◆ KDbQueryAsterisk() [4/4]

KDbQueryAsterisk::KDbQueryAsterisk ( KDbQuerySchema * query,
const KDbTableSchema * table )
protected

Definition at line 45 of file KDbQueryAsterisk.cpp.

Member Function Documentation

◆ copy()

KDbField * KDbQueryAsterisk::copy ( )
overrideprotectedvirtual
Returns
a deep copy of this object. Used in KDbFieldList(const KDbFieldList& fl).

Reimplemented from KDbField.

Definition at line 83 of file KDbQueryAsterisk.cpp.

◆ isAllTableAsterisk()

bool KDbQueryAsterisk::isAllTableAsterisk ( ) const

This is convenience method that returns true if the asterisk has "single-table" type (2nd type).

Definition at line 98 of file KDbQueryAsterisk.cpp.

◆ isSingleTableAsterisk()

bool KDbQueryAsterisk::isSingleTableAsterisk ( ) const

This is convenience method that returns true if the asterisk has "all-tables" type (2nd type).

Definition at line 93 of file KDbQueryAsterisk.cpp.

◆ operator!=()

bool KDbQueryAsterisk::operator!= ( const KDbQueryAsterisk & other) const
inline

Returns true if this query asterisk is not equal to other.

Returns
false if objects are equal.
See also
operator==(const KDbQueryAsterisk&)
Since
3.1

Definition at line 93 of file KDbQueryAsterisk.h.

◆ operator==()

bool KDbQueryAsterisk::operator== ( const KDbQueryAsterisk & other) const

Returns true if this query asterisk is equal to other.

Returns
false if the objects are not equal. Two asterisks are equal if they return the same table() and query(). This also means that both return the same value for isSingleTableAsterisk() and isAllTableAsterisk().
Since
3.1

Definition at line 63 of file KDbQueryAsterisk.cpp.

◆ query() [1/2]

KDbQuerySchema * KDbQueryAsterisk::query ( )
Returns
Query object for that this asterisk object is defined

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 68 of file KDbQueryAsterisk.cpp.

◆ query() [2/2]

const KDbQuerySchema * KDbQueryAsterisk::query ( ) const

Definition at line 73 of file KDbQueryAsterisk.cpp.

◆ setTable()

void KDbQueryAsterisk::setTable ( const KDbTableSchema * table)

Sets table schema for this asterisk. If table is supplied, the asterisk become a "single-table" asterisk. If table is nullptr the asterisk becames "all-tables" asterisk.

Definition at line 88 of file KDbQueryAsterisk.cpp.

◆ table()

const KDbTableSchema * KDbQueryAsterisk::table ( ) const
Returns
table schema object for that this asterisk object is defined. If this is a "all-tables" asterisk, nullptr is returned.

Definition at line 78 of file KDbQueryAsterisk.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.