Eneboo - Documentación para desarrolladores
|
The QSqlIndex class provides functions to manipulate and describe QSqlCursor and QSqlDatabase indexes. Más...
#include <qsqlindex.h>
Métodos públicos | |
QSqlIndex (const QString &cursorName=QString::null, const QString &name=QString::null) | |
QSqlIndex (const QSqlIndex &other) | |
~QSqlIndex () | |
QSqlIndex & | operator= (const QSqlIndex &other) |
virtual void | setCursorName (const QString &cursorName) |
QString | cursorName () const |
virtual void | setName (const QString &name) |
QString | name () const |
void | append (const QSqlField &field) |
virtual void | append (const QSqlField &field, bool desc) |
bool | isDescending (int i) const |
virtual void | setDescending (int i, bool desc) |
QString | toString (const QString &prefix=QString::null, const QString &sep=",", bool verbose=TRUE) const |
QStringList | toStringList (const QString &prefix=QString::null, bool verbose=TRUE) const |
QSqlIndex (const QString &cursorName=QString::null, const QString &name=QString::null) | |
QSqlIndex (const QSqlIndex &other) | |
~QSqlIndex () | |
QSqlIndex & | operator= (const QSqlIndex &other) |
virtual void | setCursorName (const QString &cursorName) |
QString | cursorName () const |
virtual void | setName (const QString &name) |
QString | name () const |
void | append (const QSqlField &field) |
virtual void | append (const QSqlField &field, bool desc) |
bool | isDescending (int i) const |
virtual void | setDescending (int i, bool desc) |
QString | toString (const QString &prefix=QString::null, const QString &sep=",", bool verbose=TRUE) const |
QStringList | toStringList (const QString &prefix=QString::null, bool verbose=TRUE) const |
Métodos públicos estáticos | |
static QSqlIndex | fromStringList (const QStringList &l, const QSqlCursor *cursor) |
static QSqlIndex | fromStringList (const QStringList &l, const QSqlCursor *cursor) |
The QSqlIndex class provides functions to manipulate and describe QSqlCursor and QSqlDatabase indexes.
sql
This class is used to describe and manipulate QSqlCursor and QSqlDatabase 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, or to affect the behavior of a QSqlCursor object.
Normally, QSqlIndex objects are created by QSqlDatabase or QSqlCursor.
QSqlIndex::QSqlIndex | ( | const QString & | cursorname = QString::null , |
const QString & | name = QString::null |
||
) |
Constructs an empty index using the cursor name cursorname and index name name.
QSqlIndex::QSqlIndex | ( | const QSqlIndex & | other | ) |
Constructs a copy of other.
QSqlIndex::~QSqlIndex | ( | ) |
Destroys the object and frees any allocated resources.
QSqlIndex::QSqlIndex | ( | const QString & | cursorName = QString::null , |
const QString & | name = QString::null |
||
) |
QSqlIndex::QSqlIndex | ( | const QSqlIndex & | other | ) |
QSqlIndex::~QSqlIndex | ( | ) |
void QSqlIndex::append | ( | const QSqlField & | field | ) | [virtual] |
Appends the field field to the list of indexed fields. The field is appended with an ascending sort order.
Reimplementado de QSqlRecord.
void QSqlIndex::append | ( | const QSqlField & | field | ) | [virtual] |
Append a copy of field field to the end of the record.
Reimplementado de QSqlRecord.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Appends the field field to the list of indexed fields. The field is appended with an ascending sort order, unless desc is TRUE.
QString QSqlIndex::cursorName | ( | ) | const [inline] |
Returns the name of the cursor which the index is associated with.
QString QSqlIndex::cursorName | ( | ) | const [inline] |
QSqlIndex QSqlIndex::fromStringList | ( | const QStringList & | l, |
const QSqlCursor * | cursor | ||
) | [static] |
Returns an index based on the field descriptions in l and the cursor cursor. The field descriptions should be in the same format that toStringList() produces, for example, a surname field in the people table might be in one of these forms: "surname", "surname DESC" or "people.surname ASC".
static QSqlIndex QSqlIndex::fromStringList | ( | const QStringList & | l, |
const QSqlCursor * | cursor | ||
) | [static] |
Returns TRUE if field i in the index is sorted in descending order; otherwise returns FALSE.
QString QSqlIndex::name | ( | ) | const [inline] |
QString QSqlIndex::name | ( | ) | const [inline] |
Returns the name of the index.
void QSqlIndex::setCursorName | ( | const QString & | cursorName | ) | [virtual] |
Sets the name of the cursor that the index is associated with to cursorName.
virtual void QSqlIndex::setCursorName | ( | const QString & | cursorName | ) | [virtual] |
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.
virtual void QSqlIndex::setName | ( | const QString & | name | ) | [virtual] |
void QSqlIndex::setName | ( | const QString & | name | ) | [virtual] |
Sets the name of the index to name.
QString QSqlIndex::toString | ( | const QString & | prefix = QString::null , |
const QString & | sep = "," , |
||
bool | verbose = TRUE |
||
) | const |
Returns a comma-separated list of all the index's field names as a string. This string is suitable, for example, for generating a SQL SELECT statement. Only generated fields are included in the list (see {isGenerated()}). If a prefix is specified, e.g. a table name, it is prepended before all field names in the form:
"\a{prefix}.<fieldname>"
If sep is specified, each field is separated by sep. If verbose is TRUE (the default), each field contains a suffix indicating an ASCending or DESCending sort order.
QString QSqlIndex::toString | ( | const QString & | prefix = QString::null , |
const QString & | sep = "," , |
||
bool | verbose = TRUE |
||
) | const |
QStringList QSqlIndex::toStringList | ( | const QString & | prefix = QString::null , |
bool | verbose = TRUE |
||
) | const |
QStringList QSqlIndex::toStringList | ( | const QString & | prefix = QString::null , |
bool | verbose = TRUE |
||
) | const |
Returns a list of all the index's field names. Only generated fields are included in the list (see {isGenerated()}). If a prefix is specified, e.g. a table name, all fields are prefixed in the form:
"\a{prefix}.<fieldname>"
If verbose is TRUE (the default), each field contains a suffix indicating an ASCending or DESCending sort order.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
QStringList list = myIndex.toStringList(); QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }