返回介绍

QSqlIndex Class

发布于 2019-10-04 15:02:55 字数 4401 浏览 1017 评论 0 收藏 0

The QSqlIndex class provides functions to manipulate and describe QSqlCursor and QSqlDatabase indexes. More...

#include <qsqlindex.h>

Inherits QSqlRecord.

List of all member functions.

Public Members

  • QSqlIndex ( constQString&cursorname = QString::null, constQString&name = QString::null )
  • QSqlIndex ( constQSqlIndex&other )
  • ~QSqlIndex ()
  • QSqlIndex & operator= ( constQSqlIndex&other )
  • virtual void setCursorName ( constQString&cursorName )
  • QString cursorName () const
  • virtual void setName ( constQString&name )
  • QString name () const
  • virtual void append ( constQSqlField&field )
  • virtual void append ( constQSqlField&field, booldesc )
  • bool isDescending ( inti ) const
  • virtual void setDescending ( inti, booldesc )

Static Public Members

  • QSqlIndex fromStringList ( constQStringList&l, constQSqlCursor*cursor )

Detailed Description

The QSqlIndex class provides functions to manipulate and describe QSqlCursor and QSqlDatabase indexes.

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.

See also Database Classes.


Member Function Documentation

QSqlIndex::QSqlIndex ( constQString&cursorname = QString::null, constQString&name = QString::null )

Constructs an empty index using the cursor name cursorname and index name name.

QSqlIndex::QSqlIndex ( constQSqlIndex&other )

Constructs a copy of other.

QSqlIndex::~QSqlIndex ()

Destroys the object and frees any allocated resources.

void QSqlIndex::append ( constQSqlField&field ) [virtual]

Appends the field field to the list of indexed fields. The field is appended with an ascending sort order.

Reimplemented from QSqlRecord.

void QSqlIndex::append ( constQSqlField&field, booldesc ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

Returns the name of the cursor which the index is associated with.

QSqlIndex QSqlIndex::fromStringList ( constQStringList&l, constQSqlCursor*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".

See also toStringList().

bool QSqlIndex::isDescending ( inti ) const

Returns true if field i in the index is sorted in descending order, otherwise returns FALSE.

QString QSqlIndex::name () const

Returns the name of the index.

QSqlIndex& QSqlIndex::operator= ( constQSqlIndex&other )

Sets the index equal to other.

void QSqlIndex::setCursorName ( constQString&cursorName ) [virtual]

Sets the name of the cursor that the index is associated with to cursorName.

void QSqlIndex::setDescending ( inti, booldesc ) [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.

void QSqlIndex::setName ( constQString&name ) [virtual]

Sets the name of the index to name.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文