|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
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. |
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. |
boolean |
equals(java.lang.Object other)
|
QSqlField |
field(int i)
Returns the field at position i. |
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 i. |
static QSqlRecord |
fromNativePointer(QNativePointer nativePointer)
This function returns the QSqlRecord instance pointed to by nativePointer |
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 i 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 i is null or if there is no field at position i; 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. |
static QNativePointer |
nativePointerArray(QSqlRecord[] array)
This function returns a QNativePointer that is pointing to the specified QSqlRecord array. |
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 i 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 i 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 i to val. |
void |
setValue(java.lang.String name,
java.lang.Object val)
Sets the value of the field called name to val. |
java.lang.Object |
value(int i)
Returns the value of the field located at position i 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, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QSqlRecord()
Constructs an empty record.
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 |
---|
public void append(QSqlField field)
Append a copy of field field to the end of the record.
public final void clear()
Removes all the record's fields.
public final void clearValues()
Clears the value of all fields in the record and sets each field to null.
public final boolean contains(java.lang.String name)
Returns true if there is a field in the record called name; otherwise returns false.
public final int count()
Returns the number of fields in the record.
public final QSqlField field(int i)
Returns the field at position i. If the position is out of range, an empty field is returned.
public final QSqlField field(java.lang.String name)
Returns the field called name.
public final java.lang.String fieldName(int i)
Returns the name of the field at position i. If the field does not exist, an empty string is returned.
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.
public final void insert(int pos, QSqlField field)
Inserts the field field at position pos in the record.
public final boolean isEmpty()
Returns true if there are no fields in the record; otherwise returns false.
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.
public final boolean isGenerated(int i)
Returns true if the record has a field at position i and this field is to be generated (the default); otherwise returns false.
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.
public final boolean isNull(int i)
Returns true if the field i is null or if there is no field at position i; otherwise returns false.
public final void remove(int pos)
Removes the field at position pos. If pos is out of range, nothing happens.
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.
public final void setGenerated(int i, boolean generated)
Sets the generated flag for the field i to generated.
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.
public final void setNull(int i)
Sets the value of field i to null. If the field does not exist, nothing happens.
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.
public final void setValue(int i, java.lang.Object val)
Sets the value of the field at position i to val. If the field does not exist, nothing happens.
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.
public final java.lang.Object value(int i)
Returns the value of the field located at position i in the record. If i is out of bounds, an invalid QVariant is returned.
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.
public static QSqlRecord fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QSqlRecord[] array)
array
- the array that the returned pointer will point to.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |