|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.sql.QSqlRecord
public class QSqlRecord
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().
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()
|
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 |
|---|
public QSqlRecord()
isEmpty(), append(), and insert().
public QSqlRecord(QSqlRecord other)
QSqlRecord is implicitly shared. This means you can make copies of a record in constant time.
| Method Detail |
|---|
public void append(QSqlField field)
insert(), replace(), and remove().
public final void clear()
clearValues(), and isEmpty().
public final void clearValues()
setValue().
public final boolean contains(java.lang.String name)
public final int count()
isEmpty().
public final QSqlField field(java.lang.String name)
public final QSqlField field(int i)
public final java.lang.String fieldName(int i)
indexOf().
public final int indexOf(java.lang.String name)
fieldName().
public final void insert(int pos,
QSqlField field)
append(), replace(), and remove().
public final boolean isEmpty()
append(), insert(), and clear().
public final boolean isGenerated(java.lang.String name)
setGenerated().
public final boolean isGenerated(int i)
setGenerated().
public final boolean isNull(java.lang.String name)
setNull().
public final boolean isNull(int i)
public final void remove(int pos)
append(), insert(), and replace().
public final void replace(int pos,
QSqlField field)
append(), insert(), and remove().
public final void setGenerated(java.lang.String name,
boolean generated)
QSqlQueryModel for example. isGenerated().
public final void setGenerated(int i,
boolean generated)
isGenerated().
public final void setNull(java.lang.String name)
public final void setNull(int i)
isNull(), and setValue().
public final void setValue(java.lang.String name,
java.lang.Object val)
public final void setValue(int i,
java.lang.Object val)
value(), and setNull().
public final java.lang.Object value(java.lang.String name)
indexOf().
public final java.lang.Object value(int i)
QVariant is returned. setValue(), fieldName(), and isNull().
public java.lang.String toString()
toString in class java.lang.Objectpublic QSqlRecord clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||