继承者: QSqlIndex
PySide.QtSql.QSqlRecord class encapsulates a database record.
PySide.QtSql.QSqlRecord class encapsulates the functionality and characteristics of a database record (usually a row in a table or view within the database). PySide.QtSql.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 PySide.QtSql.QSqlRecord.setValue() ; if you want to set a field to null use PySide.QtSql.QSqlRecord.setNull() . To find the position of a field by name use PySide.QtSql.QSqlRecord.indexOf() , and to find the name of a field at a particular position use PySide.QtSql.QSqlRecord.fieldName() 。使用 PySide.QtSql.QSqlRecord.field() to retrieve a PySide.QtSql.QSqlField object for a given field. Use PySide.QtSql.QSqlRecord.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 PySide.QtSql.QSqlRecord.isGenerated() is true are included in the generated SQL.
A record can have fields added with PySide.QtSql.QSqlRecord.append() or PySide.QtSql.QSqlRecord.insert() , replaced with PySide.QtSql.QSqlRecord.replace() , and removed with PySide.QtSql.QSqlRecord.remove() . All the fields can be removed with PySide.QtSql.QSqlRecord.clear() . The number of fields is given by PySide.QtSql.QSqlRecord.count() ; all their values can be cleared (to null) using PySide.QtSql.QSqlRecord.clearValues() .
| 参数: | other – PySide.QtSql.QSqlRecord |
|---|
Constructs an empty record.
另请参阅
PySide.QtSql.QSqlRecord.isEmpty() PySide.QtSql.QSqlRecord.append() PySide.QtSql.QSqlRecord.insert()
构造副本为 other .
PySide.QtSql.QSqlRecord is 隐式共享 . This means you can make copies of a record in constant time .
| 参数: | field – PySide.QtSql.QSqlField |
|---|
Append a copy of field field to the end of the record.
Removes all the record's fields.
Clears the value of all fields in the record and sets each field to null.
| 参数: | name – unicode |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if there is a field in the record called name ;否则返回 false。
| 返回类型: | PySide.QtCore.int |
|---|
Returns the number of fields in the record.
| 参数: | i – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtSql.QSqlField |
Returns the field at position index 。若 index is out of range, function returns a 默认构造值 .
| 参数: | name – unicode |
|---|---|
| 返回类型: | PySide.QtSql.QSqlField |
这是重载函数。
Returns the field called name .
| 参数: | i – PySide.QtCore.int |
|---|---|
| 返回类型: | unicode |
Returns the name of the field at position index . If the field does not exist, an empty string is returned.
| 参数: | name – unicode |
|---|---|
| 返回类型: | PySide.QtCore.int |
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.
| 参数: |
|
|---|
Inserts the field field 在位置 pos in the record.
| 返回类型: | PySide.QtCore.bool |
|---|
Returns true if there are no fields in the record; otherwise returns false.
| 参数: | name – unicode |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if the record has a field called name and this field is to be generated (the default); otherwise returns false.
| 参数: | i – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtCore.bool |
这是重载函数。
Returns true if the record has a field at position index and this field is to be generated (the default); otherwise returns false.
| 参数: | i – PySide.QtCore.int |
|---|---|
| 返回类型: | PySide.QtCore.bool |
这是重载函数。
Returns true if the field index is null or if there is no field at position index ;否则返回 false。
| 参数: | name – unicode |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if the field called name is null or if there is no field called name ;否则返回 false。
| 参数: | other – PySide.QtSql.QSqlRecord |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this object is not identical to other ;否则返回 false。
另请参阅
PySide.QtSql.QSqlRecord.operator==()
| 参数: | other – PySide.QtSql.QSqlRecord |
|---|---|
| 返回类型: | PySide.QtCore.bool |
Returns true if this object is identical to other (i.e., has the same fields in the same order); otherwise returns false.
另请参阅
PySide.QtSql.QSqlRecord.operator!=()
| 参数: | pos – PySide.QtCore.int |
|---|
Removes the field at position pos 。若 pos is out of range, nothing happens.
| 参数: |
|
|---|
Replaces the field at position pos 采用给定 field 。若 pos is out of range, nothing happens.
| 参数: |
|
|---|
这是重载函数。
Sets the generated flag for the field index to 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 PySide.QtSql.QSqlQueryModel 例如。
| 参数: | i – PySide.QtCore.int |
|---|
Sets the value of field index to null. If the field does not exist, nothing happens.
| 参数: | name – unicode |
|---|
这是重载函数。
Sets the value of the field called name to null. If the field does not exist, nothing happens.
| 参数: |
|
|---|
Sets the value of the field at position index to val . If the field does not exist, nothing happens.
| 参数: |
|
|---|
这是重载函数。
Sets the value of the field called name to val . If the field does not exist, nothing happens.
| 参数: | name – unicode |
|---|---|
| 返回类型: | object |
这是重载函数。
Returns the value of the field called name in the record. If field name does not exist an invalid variant is returned.
| 参数: | i – PySide.QtCore.int |
|---|---|
| 返回类型: | object |
Returns the value of the field located at position index in the record. If index is out of bounds, an invalid PySide.QtCore.QVariant 被返回。