<class name="QSqlRecord" doc="/** <p>The <a href="QSqlRecord.html#QSqlRecord(com.trolltech.qt.sql.QSqlRecord)"><tt>QSqlRecord</tt></a> class encapsulates a database record.</p> <p>The <a href="QSqlRecord.html#QSqlRecord(com.trolltech.qt.sql.QSqlRecord)"><tt>QSqlRecord</tt></a> class encapsulates the functionality and characteristics of a database record (usually a row in a table or view within the database). <a href="QSqlRecord.html#QSqlRecord(com.trolltech.qt.sql.QSqlRecord)"><tt>QSqlRecord</tt></a> supports adding and removing fields as well as setting and retrieving field values.</p> <p>The values of a record's fields' can be set by name or position with <a href="QSqlRecord.html#setValue(java.lang.String, java.lang.Object)"><tt>setValue</tt></a>; if you want to set a field to null use <a href="QSqlRecord.html#setNull(java.lang.String)"><tt>setNull</tt></a>. To find the position of a field by name use <a href="QSqlRecord.html#indexOf(java.lang.String)"><tt>indexOf</tt></a>, and to find the name of a field at a particular position use <a href="QSqlRecord.html#fieldName(int)"><tt>fieldName</tt></a>. Use <a href="QSqlRecord.html#field(java.lang.String)"><tt>field</tt></a> to retrieve a <a href="QSqlField.html"><tt>QSqlField</tt></a> object for a given field. Use <a href="QSqlRecord.html#contains(java.lang.String)"><tt>contains</tt></a> to see if the record contains a particular field name.</p> <p>When queries are generated to be executed on the database only those fields for which <a href="QSqlRecord.html#isGenerated(int)"><tt>isGenerated</tt></a> is true are included in the generated SQL.</p> <p>A record can have fields added with <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> or <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a>, replaced with <a href="QSqlRecord.html#replace(int, com.trolltech.qt.sql.QSqlField)"><tt>replace</tt></a>, and removed with <a href="QSqlRecord.html#remove(int)"><tt>remove</tt></a>. All the fields can be removed with <a href="QSqlRecord.html#clear()"><tt>clear</tt></a>. The number of fields is given by <a href="QSqlRecord.html#count()"><tt>count</tt></a>; all their values can be cleared (to null) using <a href="QSqlRecord.html#clearValues()"><tt>clearValues</tt></a>.</p> @see <a href="QSqlField.html"><tt>QSqlField</tt></a> @see <tt>QSqlQuery::record</tt> */"> <method name="public QSqlRecord()" doc="/** <p>Constructs an empty record.</p> @see <a href="QSqlRecord.html#isEmpty()"><tt>isEmpty</tt></a> @see <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> @see <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a> */"/> <method name="public QSqlRecord(com.trolltech.qt.sql.QSqlRecord other)" doc="/** <p>Constructs a copy of <tt>other</tt>.</p> <p><a href="QSqlRecord.html#QSqlRecord(com.trolltech.qt.sql.QSqlRecord)"><tt>QSqlRecord</tt></a> is implicitly shared</tt>. This means you can make copies of a record in constant time</tt>.</p> */"/> <method name="public void append(com.trolltech.qt.sql.QSqlField field)" doc="/** <p>Append a copy of field <tt>field</tt> to the end of the record.</p> @see <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a> @see <a href="QSqlRecord.html#replace(int, com.trolltech.qt.sql.QSqlField)"><tt>replace</tt></a> @see <a href="QSqlRecord.html#remove(int)"><tt>remove</tt></a> */"/> <method name="public final void clear()" doc="/** <p>Removes all the record's fields.</p> @see <a href="QSqlRecord.html#clearValues()"><tt>clearValues</tt></a> @see <a href="QSqlRecord.html#isEmpty()"><tt>isEmpty</tt></a> */"/> <method name="public final void clearValues()" doc="/** <p>Clears the value of all fields in the record and sets each field to null.</p> @see <a href="QSqlRecord.html#setValue(java.lang.String, java.lang.Object)"><tt>setValue</tt></a> */"/> <method name="public final boolean contains(java.lang.String name)" doc="/** <p>Returns true if there is a field in the record called <tt>name</tt>; otherwise returns false.</p> */"/> <method name="public final int count()" doc="/** <p>Returns the number of fields in the record.</p> @see <a href="QSqlRecord.html#isEmpty()"><tt>isEmpty</tt></a> */"/> <method name="public final com.trolltech.qt.sql.QSqlField field(int i)" doc="/** <p>Returns the field at position <tt>i</tt>. If the position is out of range, an empty field is returned.</p> */"/> <method name="public final com.trolltech.qt.sql.QSqlField field(java.lang.String name)" doc="/** <p>Returns the field called <tt>name</tt>.</p> */"/> <method name="public final java.lang.String fieldName(int i)" doc="/** <p>Returns the name of the field at position <tt>i</tt>. If the field does not exist, an empty string is returned.</p> @see <a href="QSqlRecord.html#indexOf(java.lang.String)"><tt>indexOf</tt></a> */"/> <method name="public final int indexOf(java.lang.String name)" doc="/** <p>Returns the position of the field called <tt>name</tt> 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.</p> @see <a href="QSqlRecord.html#fieldName(int)"><tt>fieldName</tt></a> */"/> <method name="public final void insert(int pos, com.trolltech.qt.sql.QSqlField field)" doc="/** <p>Inserts the field <tt>field</tt> at position <tt>pos</tt> in the record.</p> @see <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> @see <a href="QSqlRecord.html#replace(int, com.trolltech.qt.sql.QSqlField)"><tt>replace</tt></a> @see <a href="QSqlRecord.html#remove(int)"><tt>remove</tt></a> */"/> <method name="public final boolean isEmpty()" doc="/** <p>Returns true if there are no fields in the record; otherwise returns false.</p> @see <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> @see <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a> @see <a href="QSqlRecord.html#clear()"><tt>clear</tt></a> */"/> <method name="public final boolean isGenerated(java.lang.String name)" doc="/** <p>Returns true if the record has a field called <tt>name</tt> and this field is to be generated (the default); otherwise returns false.</p> @see <a href="QSqlRecord.html#setGenerated(java.lang.String, boolean)"><tt>setGenerated</tt></a> */"/> <method name="public final boolean isGenerated(int i)" doc="/** <p>Returns true if the record has a field at position <tt>i</tt> and this field is to be generated (the default); otherwise returns false.</p> @see <a href="QSqlRecord.html#setGenerated(java.lang.String, boolean)"><tt>setGenerated</tt></a> */"/> <method name="public final boolean isNull(java.lang.String name)" doc="/** <p>Returns true if the field called <tt>name</tt> is null or if there is no field called <tt>name</tt>; otherwise returns false.</p> @see <a href="QSqlRecord.html#setNull(java.lang.String)"><tt>setNull</tt></a> */"/> <method name="public final boolean isNull(int i)" doc="/** <p>Returns true if the field <tt>i</tt> is null or if there is no field at position <tt>i</tt>; otherwise returns false.</p> */"/> <method name="public final void remove(int pos)" doc="/** <p>Removes the field at position <tt>pos</tt>. If <tt>pos</tt> is out of range, nothing happens.</p> @see <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> @see <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a> @see <a href="QSqlRecord.html#replace(int, com.trolltech.qt.sql.QSqlField)"><tt>replace</tt></a> */"/> <method name="public final void replace(int pos, com.trolltech.qt.sql.QSqlField field)" doc="/** <p>Replaces the field at position <tt>pos</tt> with the given <tt>field</tt>. If <tt>pos</tt> is out of range, nothing happens.</p> @see <a href="QSqlRecord.html#append(com.trolltech.qt.sql.QSqlField)"><tt>append</tt></a> @see <a href="QSqlRecord.html#insert(int, com.trolltech.qt.sql.QSqlField)"><tt>insert</tt></a> @see <a href="QSqlRecord.html#remove(int)"><tt>remove</tt></a> */"/> <method name="public final void setGenerated(int i, boolean generated)" doc="/** <p>Sets the generated flag for the field <tt>i</tt> to <tt>generated</tt>.</p> @see <a href="QSqlRecord.html#isGenerated(int)"><tt>isGenerated</tt></a> */"/> <method name="public final void setGenerated(java.lang.String name, boolean generated)" doc="/** <p>Sets the generated flag for the field called <tt>name</tt> to <tt>generated</tt>. If the field does not exist, nothing happens. Only fields that have <tt>generated</tt> set to true are included in the SQL that is generated by <a href="QSqlQueryModel.html"><tt>QSqlQueryModel</tt></a> for example.</p> @see <a href="QSqlRecord.html#isGenerated(int)"><tt>isGenerated</tt></a> */"/> <method name="public final void setNull(int i)" doc="/** <p>Sets the value of field <tt>i</tt> to null. If the field does not exist, nothing happens.</p> @see <a href="QSqlRecord.html#setValue(java.lang.String, java.lang.Object)"><tt>setValue</tt></a> */"/> <method name="public final void setNull(java.lang.String name)" doc="/** <p>Sets the value of the field called <tt>name</tt> to null. If the field does not exist, nothing happens.</p> @see <a href="QSqlRecord.html#isNull(int)"><tt>isNull</tt></a> */"/> <method name="public final void setValue(int i, java.lang.Object val)" doc="/** <p>Sets the value of the field at position <tt>i</tt> to <tt>val</tt>. If the field does not exist, nothing happens.</p> @see <a href="QSqlRecord.html#setNull(java.lang.String)"><tt>setNull</tt></a> */"/> <method name="public final void setValue(java.lang.String name, java.lang.Object val)" doc="/** <p>Sets the value of the field called <tt>name</tt> to <tt>val</tt>. If the field does not exist, nothing happens.</p> @see <a href="QSqlRecord.html#value(java.lang.String)"><tt>value</tt></a> */"/> <method name="public final java.lang.Object value(int i)" doc="/** <p>Returns the value of the field located at position <tt>i</tt> in the record. If <tt>i</tt> is out of bounds, an invalid <a href="%2E%2E/porting4.html#qvariant"><tt>QVariant</tt></a> is returned.</p> @see <a href="QSqlRecord.html#fieldName(int)"><tt>fieldName</tt></a> @see <a href="QSqlRecord.html#isNull(int)"><tt>isNull</tt></a> */"/> <method name="public final java.lang.Object value(java.lang.String name)" doc="/** <p>Returns the value of the field called <tt>name</tt> in the record. If field <tt>name</tt> does not exist an invalid variant is returned.</p> @see <a href="QSqlRecord.html#setValue(java.lang.String, java.lang.Object)"><tt>setValue</tt></a> @see <a href="QSqlRecord.html#indexOf(java.lang.String)"><tt>indexOf</tt></a> */"/> </class>