Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.sql
Class QSqlRecord

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.sql.QSqlRecord

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

Direct Known Subclasses:
  QSqlIndex

    public class QSqlRecord

extends QtJambiObject
implements java.lang.Cloneable

The `QSqlRecord` class encapsulates a database record. The `QSqlRecord` class encapsulates the functionality and characteristics of a database record (usually a row in a table or view within the database). `QSqlRecord` supports adding and removing fields as well as setting and retrieving field values.

The values of a record's fields' can be set by name or position with `setValue()`; if you want to set a field to null use `setNull()`. To find the position of a field by name use `indexOf()`, and to find the name of a field at a particular position use `fieldName()`. Use `field()` to retrieve a `QSqlField` object for a given field. Use `contains()` to see if the record contains a particular field name.

When queries are generated to be executed on the database only those fields for which `isGenerated()` is true are included in the generated SQL.

A record can have fields added with `append()` or `insert()`, replaced with `replace()`, and removed with `remove()`. All the fields can be removed with `clear()`. The number of fields is given by `count()`; all their values can be cleared (to null) using `clearValues()`.

See also:
  `QSqlField`, and `QSqlQuery::record()`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QSqlRecord()` Constructs an empty record.
`QSqlRecord(QSqlRecord other)` Constructs a copy of `other`.

Method Summary
`void` | `append(QSqlField field)` Append a copy of field `field` to the end of the record.
`void` | `clear()` Removes all the record's fields.
`void` | `clearValues()` Clears the value of all fields in the record and sets each field to null.
`QSqlRecord` | `clone()` This method is reimplemented for internal reasons
`boolean` | `contains(java.lang.String name)` Returns true if there is a field in the record called `name`; otherwise returns false.
`int` | `count()` Returns the number of fields in the record.
`QSqlField` | `field(int i)` Returns the field at position `index`.
`QSqlField` | `field(java.lang.String name)` Returns the field called `name`.
`java.lang.String` | `fieldName(int i)` Returns the name of the field at position `index`.
`int` | `indexOf(java.lang.String name)` Returns the position of the field called `name` within the record, or -1 if it cannot be found.
`void` | `insert(int pos, QSqlField field)` Inserts the field `field` at position `pos` in the record.
`boolean` | `isEmpty()` Returns true if there are no fields in the record; otherwise returns false.
`boolean` | `isGenerated(int i)` Returns true if the record has a field at position `index` and this field is to be generated (the default); otherwise returns false.
`boolean` | `isGenerated(java.lang.String name)` Returns true if the record has a field called `name` and this field is to be generated (the default); otherwise returns false.
`boolean` | `isNull(int i)` Returns true if the field `index` is null or if there is no field at position `index`; otherwise returns false.
`boolean` | `isNull(java.lang.String name)` Returns true if the field called `name` is null or if there is no field called `name`; otherwise returns false.
`void` | `remove(int pos)` Removes the field at position `pos`.
`void` | `replace(int pos, QSqlField field)` Replaces the field at position `pos` with the given `field`.
`void` | `setGenerated(int i, boolean generated)` Sets the generated flag for the field `index` to `generated`.
`void` | `setGenerated(java.lang.String name, boolean generated)` Sets the generated flag for the field called `name` to `generated`.
`void` | `setNull(int i)` Sets the value of field `index` to null.
`void` | `setNull(java.lang.String name)` Sets the value of the field called `name` to null.
`void` | `setValue(int i, java.lang.Object val)` Sets the value of the field at position `index` to `val`.
`void` | `setValue(java.lang.String name, java.lang.Object val)` Sets the value of the field called `name` to `val`.
`java.lang.String` | `toString()` Returns a string representation of the `this QSqlRecord`.
`java.lang.Object` | `value(int i)` Returns the value of the field located at position `index` in the record.
`java.lang.Object` | `value(java.lang.String name)` Returns the value of the field called `name` in the record.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QSqlRecord

    public QSqlRecord()

  Constructs an empty record.

See also:
  `isEmpty()`, `append()`, and `insert()`.

### QSqlRecord

    public QSqlRecord(QSqlRecord other)

  Constructs a copy of `other`.

  `QSqlRecord` is implicitly shared. This means you can make copies of a record in constant time.

Method Detail

### append

    public void append(QSqlField field)

  Append a copy of field `field` to the end of the record.

See also:
  `insert()`, `replace()`, and `remove()`.

### clear

    public final void clear()

  Removes all the record's fields.

See also:
  `clearValues()`, and `isEmpty()`.

### clearValues

    public final void clearValues()

  Clears the value of all fields in the record and sets each field to null.

See also:
  `setValue()`.

### contains

    public final boolean contains(java.lang.String name)

  Returns true if there is a field in the record called `name`; otherwise returns false.

### count

    public final int count()

  Returns the number of fields in the record.

See also:
  `isEmpty()`.

### field

    public final QSqlField field(java.lang.String name)

  Returns the field called `name`.

### field

    public final QSqlField field(int i)

  Returns the field at position `index`. If the position is out of range, an empty field is returned.

### fieldName

    public final java.lang.String fieldName(int i)

  Returns the name of the field at position `index`. If the field does not exist, an empty string is returned.

See also:
  `indexOf()`.

### indexOf

    public final int indexOf(java.lang.String name)

  Returns the position of the field called `name` within the record, or -1 if it cannot be found. Field names are not case-sensitive. If more than one field matches, the first one is returned.

See also:
  `fieldName()`.

### insert

    public final void insert(int pos,
                             QSqlField field)

  Inserts the field `field` at position `pos` in the record.

See also:
  `append()`, `replace()`, and `remove()`.

### isEmpty

    public final boolean isEmpty()

  Returns true if there are no fields in the record; otherwise returns false.

See also:
  `append()`, `insert()`, and `clear()`.

### isGenerated

    public final boolean isGenerated(java.lang.String name)

  Returns true if the record has a field called `name` and this field is to be generated (the default); otherwise returns false.

See also:
  `setGenerated()`.

### isGenerated

    public final boolean isGenerated(int i)

  Returns true if the record has a field at position `index` and this field is to be generated (the default); otherwise returns false.

See also:
  `setGenerated()`.

### isNull

    public final boolean isNull(java.lang.String name)

  Returns true if the field called `name` is null or if there is no field called `name`; otherwise returns false.

See also:
  `setNull()`.

### isNull

    public final boolean isNull(int i)

  Returns true if the field `index` is null or if there is no field at position `index`; otherwise returns false.

### remove

    public final void remove(int pos)

  Removes the field at position `pos`. If `pos` is out of range, nothing happens.

See also:
  `append()`, `insert()`, and `replace()`.

### replace

    public final void replace(int pos,
                              QSqlField field)

  Replaces the field at position `pos` with the given `field`. If `pos` is out of range, nothing happens.

See also:
  `append()`, `insert()`, and `remove()`.

### setGenerated

    public final void setGenerated(java.lang.String name,
                                   boolean generated)

  Sets the generated flag for the field called `name` to `generated`. If the field does not exist, nothing happens. Only fields that have `generated` set to true are included in the SQL that is generated by `QSqlQueryModel` for example.

See also:
  `isGenerated()`.

### setGenerated

    public final void setGenerated(int i,
                                   boolean generated)

  Sets the generated flag for the field `index` to `generated`.

See also:
  `isGenerated()`.

### setNull

    public final void setNull(java.lang.String name)

  Sets the value of the field called `name` to null. If the field does not exist, nothing happens.

### setNull

    public final void setNull(int i)

  Sets the value of field `index` to null. If the field does not exist, nothing happens.

See also:
  `isNull()`, and `setValue()`.

### setValue

    public final void setValue(java.lang.String name,
                               java.lang.Object val)

  Sets the value of the field called `name` to `val`. If the field does not exist, nothing happens.

### setValue

    public final void setValue(int i,
                               java.lang.Object val)

  Sets the value of the field at position `index` to `val`. If the field does not exist, nothing happens.

See also:
  `value()`, and `setNull()`.

### value

    public final java.lang.Object value(java.lang.String name)

  Returns the value of the field called `name` in the record. If field `name` does not exist an invalid variant is returned.

See also:
  `indexOf()`.

### value

    public final java.lang.Object value(int i)

  Returns the value of the field located at position `index` in the record. If `index` is out of bounds, an invalid `QVariant` is returned.

See also:
  `setValue()`, `fieldName()`, and `isNull()`.

### toString

    public java.lang.String toString()

  Returns a string representation of the `this QSqlRecord`.

  Overrides:
    `toString` in class `java.lang.Object`

### clone

    public QSqlRecord clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD