Qt 4.8
|
The QSqlIndex class provides functions to manipulate and describe database indexes. More...
#include <qsqlindex.h>
Public Functions | |
void | append (const QSqlField &field) |
Appends the field field to the list of indexed fields. More... | |
void | append (const QSqlField &field, bool desc) |
Appends the field field to the list of indexed fields. More... | |
QString | cursorName () const |
Returns the name of the cursor which the index is associated with. More... | |
bool | isDescending (int i) const |
Returns true if field i in the index is sorted in descending order; otherwise returns false. More... | |
QString | name () const |
Returns the name of the index. More... | |
QSqlIndex & | operator= (const QSqlIndex &other) |
Sets the index equal to other. More... | |
QSqlIndex (const QString &cursorName=QString(), const QString &name=QString()) | |
Constructs an empty index using the cursor name cursorname and index name name. More... | |
QSqlIndex (const QSqlIndex &other) | |
Constructs a copy of other. More... | |
void | setCursorName (const QString &cursorName) |
Sets the name of the cursor that the index is associated with to cursorName. More... | |
void | setDescending (int i, bool desc) |
If desc is true, field i is sorted in descending order. More... | |
void | setName (const QString &name) |
Sets the name of the index to name. More... | |
~QSqlIndex () | |
Destroys the object and frees any allocated resources. More... | |
Public Functions inherited from QSqlRecord | |
void | append (const QSqlField &field) |
Append a copy of field field to the end of the record. More... | |
void | clear () |
Removes all the record's fields. More... | |
void | clearValues () |
Clears the value of all fields in the record and sets each field to null. More... | |
bool | contains (const QString &name) const |
Returns true if there is a field in the record called name; otherwise returns false. More... | |
int | count () const |
Returns the number of fields in the record. More... | |
QSqlField | field (int i) const |
Returns the field at position index. More... | |
QSqlField | field (const QString &name) const |
Returns the field called name. More... | |
QString | fieldName (int i) const |
Returns the name of the field at position index. More... | |
int | indexOf (const QString &name) const |
Returns the position of the field called name within the record, or -1 if it cannot be found. More... | |
void | insert (int pos, const QSqlField &field) |
Inserts the field field at position pos in the record. More... | |
bool | isEmpty () const |
Returns true if there are no fields in the record; otherwise returns false. More... | |
bool | isGenerated (int i) const |
Returns true if the record has a field at position index and this field is to be generated (the default); otherwise returns false. More... | |
bool | isGenerated (const QString &name) const |
Returns true if the record has a field called name and this field is to be generated (the default); otherwise returns false. More... | |
bool | isNull (int i) const |
Returns true if the field index is null or if there is no field at position index; otherwise returns false. More... | |
bool | isNull (const QString &name) const |
Returns true if the field called name is null or if there is no field called name; otherwise returns false. More... | |
bool | operator!= (const QSqlRecord &other) const |
Returns true if this object is not identical to other; otherwise returns false. More... | |
QSqlRecord & | operator= (const QSqlRecord &other) |
Sets the record equal to other. More... | |
bool | operator== (const QSqlRecord &other) const |
Returns true if this object is identical to other (i.e., has the same fields in the same order); otherwise returns false. More... | |
QSqlRecord () | |
Constructs an empty record. More... | |
QSqlRecord (const QSqlRecord &other) | |
Constructs a copy of other. More... | |
void | remove (int pos) |
Removes the field at position pos. More... | |
void | replace (int pos, const QSqlField &field) |
Replaces the field at position pos with the given field. More... | |
void | setGenerated (const QString &name, bool generated) |
Sets the generated flag for the field called name to generated. More... | |
void | setGenerated (int i, bool generated) |
Sets the generated flag for the field index to generated. More... | |
void | setNull (int i) |
Sets the value of field index to null. More... | |
void | setNull (const QString &name) |
Sets the value of the field called name to null. More... | |
void | setValue (int i, const QVariant &val) |
Sets the value of the field at position index to val. More... | |
void | setValue (const QString &name, const QVariant &val) |
Sets the value of the field called name to val. More... | |
QVariant | value (int i) const |
Returns the value of the field located at position index in the record. More... | |
QVariant | value (const QString &name) const |
Returns the value of the field called name in the record. More... | |
~QSqlRecord () | |
Destroys the object and frees any allocated resources. More... | |
Private Functions | |
QString | createField (int i, const QString &prefix, bool verbose) const |
Creates a string representing the field number i using prefix prefix. More... | |
Properties | |
QString | cursor |
QString | nm |
QList< bool > | sorts |
The QSqlIndex class provides functions to manipulate and describe database indexes.
An index refers to a single table or view in a database. Information about the fields that comprise the index can be used to generate SQL statements.
Definition at line 55 of file qsqlindex.h.
Constructs an empty index using the cursor name cursorname and index name name.
Definition at line 70 of file qsqlindex.cpp.
QSqlIndex::QSqlIndex | ( | const QSqlIndex & | other | ) |
QSqlIndex::~QSqlIndex | ( | ) |
Destroys the object and frees any allocated resources.
Definition at line 101 of file qsqlindex.cpp.
void QSqlIndex::append | ( | const QSqlField & | field | ) |
Appends the field field to the list of indexed fields.
The field is appended with an ascending sort order.
Definition at line 129 of file qsqlindex.cpp.
Referenced by QDB2Driver::primaryIndex(), QIBaseDriver::primaryIndex(), QOCIDriver::primaryIndex(), QSQLite2Driver::primaryIndex(), QTDSDriver::primaryIndex(), QMYSQLDriver::primaryIndex(), QODBCDriver::primaryIndex(), QPSQLDriver::primaryIndex(), qExtractSecurityPolicyFromString(), and qGetTableInfo().
void QSqlIndex::append | ( | const QSqlField & | field, |
bool | desc | ||
) |
Appends the field field to the list of indexed fields.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The field is appended with an ascending sort order, unless desc is true.
Definition at line 145 of file qsqlindex.cpp.
Creates a string representing the field number i using prefix prefix.
If verbose is true, ASC or DESC is included in the field description if the field is sorted in ASCending or DESCending order.
Definition at line 240 of file qsqlindex.cpp.
Referenced by setDescending().
|
inline |
Returns the name of the cursor which the index is associated with.
Definition at line 63 of file qsqlindex.h.
Referenced by setCursorName().
bool QSqlIndex::isDescending | ( | int | i | ) | const |
Returns true if field i in the index is sorted in descending order; otherwise returns false.
Definition at line 157 of file qsqlindex.cpp.
Referenced by createField().
|
inline |
Sets the index equal to other.
Definition at line 88 of file qsqlindex.cpp.
void QSqlIndex::setCursorName | ( | const QString & | cursorName | ) |
Sets the name of the cursor that the index is associated with to cursorName.
Definition at line 266 of file qsqlindex.cpp.
Referenced by QMYSQLDriver::primaryIndex().
void QSqlIndex::setDescending | ( | int | i, |
bool | desc | ||
) |
If desc is true, field i is sorted in descending order.
Otherwise, field i is sorted in ascending order (the default). If the field does not exist, nothing happens.
Definition at line 170 of file qsqlindex.cpp.
void QSqlIndex::setName | ( | const QString & | name | ) |
Sets the name of the index to name.
Definition at line 110 of file qsqlindex.cpp.
Referenced by QDB2Driver::primaryIndex(), QIBaseDriver::primaryIndex(), QOCIDriver::primaryIndex(), QTDSDriver::primaryIndex(), QMYSQLDriver::primaryIndex(), QODBCDriver::primaryIndex(), and QPSQLDriver::primaryIndex().
|
private |
Definition at line 83 of file qsqlindex.h.
Referenced by operator=(), and setCursorName().
|
private |
Definition at line 84 of file qsqlindex.h.
Referenced by operator=(), and setName().
|
private |
Definition at line 85 of file qsqlindex.h.
Referenced by append(), isDescending(), operator=(), and setDescending().