TQSqlIndex Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQSqlIndex Class Reference
[sql module]

The TQSqlIndex class provides functions to manipulate and describe TQSqlCursor and TQSqlDatabase indexes. More...

`#include <ntqsqlindex.h>`

Inherits TQSqlRecord.

List of all member functions.

## Public Members

- TQSqlIndex ( const TQString & cursorname = TQString::null, const TQString & name = TQString::null )
- TQSqlIndex ( const TQSqlIndex & other )
- ~TQSqlIndex ()
- TQSqlIndex & operator= ( const TQSqlIndex & other )
- virtual void setCursorName ( const TQString & cursorName )
- TQString cursorName () const
- virtual void setName ( const TQString & name )
- TQString name () const
- virtual void append ( const TQSqlField & field )
- virtual void append ( const TQSqlField & field, bool desc )
- bool isDescending ( int i ) const
- virtual void setDescending ( int i, bool desc )

## Static Public Members

- TQSqlIndex fromStringList ( const TQStringList & l, const TQSqlCursor * cursor )

## Detailed Description

The TQSqlIndex class provides functions to manipulate and describe TQSqlCursor and TQSqlDatabase indexes.

This class is used to describe and manipulate TQSqlCursor and TQSqlDatabase 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 TQSqlCursor object.

Normally, TQSqlIndex objects are created by TQSqlDatabase or TQSqlCursor.

See also Database Classes.

## Member Function Documentation

### TQSqlIndex::TQSqlIndex ( const TQString & cursorname = TQString::null, const TQString & name = TQString::null )

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

### TQSqlIndex::TQSqlIndex ( const TQSqlIndex & other )

Constructs a copy of other.

### TQSqlIndex::~TQSqlIndex ()

Destroys the object and frees any allocated resources.

### void TQSqlIndex::append ( const TQSqlField & field )`[virtual]`

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

Reimplemented from TQSqlRecord.

### void TQSqlIndex::append ( const TQSqlField & field, bool desc )`[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.

### TQString TQSqlIndex::cursorName () const

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

### TQSqlIndex TQSqlIndex::fromStringList ( const TQStringList & l, const TQSqlCursor * 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 TQSqlIndex::isDescending ( int i ) const

Returns true if field i in the index is sorted in descending order; otherwise returns false.

### TQString TQSqlIndex::name () const

Returns the name of the index.

### TQSqlIndex & TQSqlIndex::operator= ( const TQSqlIndex & other )

Sets the index equal to other.

### void TQSqlIndex::setCursorName ( const TQString & cursorName )`[virtual]`

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

### void TQSqlIndex::setDescending ( int i, bool desc )`[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 TQSqlIndex::setName ( const TQString & name )`[virtual]`

Sets the name of the index to name.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.