QSqlRecordclass encapsulates a database record. 更多 …
继承者: QSqlIndex
def
__eq__
(other)
def
__ne__
(other)
def
append
(field)
def
clear
()
def
clearValues
()
def
contains
(name)
def
count
()
def
field
(i)
def
field
(name)
def
fieldName
(i)
def
indexOf
(name)
def
insert
(pos, field)
def
isEmpty
()
def
isGenerated
(i)
def
isGenerated
(name)
def
isNull
(i)
def
isNull
(name)
def
keyValues
(keyFields)
def
remove
(pos)
def
replace
(pos, field)
def
setGenerated
(i, generated)
def
setGenerated
(name, generated)
def
setNull
(i)
def
setNull
(name)
def
setValue
(i, val)
def
setValue
(name, val)
def
value
(i)
def
value
(name)
QSqlRecordclass encapsulates the functionality and characteristics of a database record (usually a row in a table or view within the database).QSqlRecordsupports 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 usesetNull(). To find the position of a field by name useindexOf(), and to find the name of a field at a particular position usefieldName()。使用field()to retrieve aQSqlFieldobject for a given field. Usecontains()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()orinsert(), replaced withreplace(), and removed withremove(). All the fields can be removed withclear(). The number of fields is given bycount(); all their values can be cleared (to null) usingclearValues().
QSqlRecord
¶
QSqlRecord(other)
- param other
Constructs an empty record.
构造副本为
other
.
QSqlRecord
is
隐式共享
. This means you can make copies of a record in
constant time
.
PySide2.QtSql.QSqlRecord.
append
(
field
)
¶
field
–
QSqlField
Append a copy of field
field
to the end of the record.
PySide2.QtSql.QSqlRecord.
clear
(
)
¶
Removes all the record’s fields.
另请参阅
PySide2.QtSql.QSqlRecord.
clearValues
(
)
¶
Clears the value of all fields in the record and sets each field to null.
另请参阅
PySide2.QtSql.QSqlRecord.
contains
(
name
)
¶
name – unicode
bool
返回
true
if there is a field in the record called
name
;否则返回
false
.
PySide2.QtSql.QSqlRecord.
count
(
)
¶
int
Returns the number of fields in the record.
另请参阅
PySide2.QtSql.QSqlRecord.
field
(
i
)
¶
i
–
int
Returns the field at position
index
。若
index
is out of range, function returns a
默认构造值
.
PySide2.QtSql.QSqlRecord.
fieldName
(
i
)
¶
i
–
int
unicode
Returns the name of the field at position
index
. If the field does not exist, an empty string is returned.
另请参阅
PySide2.QtSql.QSqlRecord.
indexOf
(
name
)
¶
name – unicode
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.
另请参阅
PySide2.QtSql.QSqlRecord.
insert
(
pos
,
field
)
¶
pos
–
int
field
–
QSqlField
Inserts the field
field
在位置
pos
in the record.
PySide2.QtSql.QSqlRecord.
isEmpty
(
)
¶
bool
返回
true
if there are no fields in the record; otherwise returns
false
.
PySide2.QtSql.QSqlRecord.
isGenerated
(
name
)
¶
name – unicode
bool
PySide2.QtSql.QSqlRecord.
isGenerated
(
i
)
¶
i
–
int
bool
这是重载函数。
返回
true
if the record has a field at position
index
and this field is to be generated (the default); otherwise returns
false
.
另请参阅
PySide2.QtSql.QSqlRecord.
isNull
(
name
)
¶
name – unicode
bool
PySide2.QtSql.QSqlRecord.
isNull
(
i
)
¶
i
–
int
bool
这是重载函数。
返回
true
if the field
index
is null or if there is no field at position
index
;否则返回
false
.
PySide2.QtSql.QSqlRecord.
keyValues
(
keyFields
)
¶
keyFields
–
QSqlRecord
Returns a record containing the fields represented in
keyFields
set to values that match by field name.
PySide2.QtSql.QSqlRecord.
__ne__
(
other
)
¶
other
–
QSqlRecord
bool
返回
true
if this object is not identical to
other
;否则返回
false
.
另请参阅
operator==()
PySide2.QtSql.QSqlRecord.
__eq__
(
other
)
¶
other
–
QSqlRecord
bool
返回
true
if this object is identical to
other
(i.e., has the same fields in the same order); otherwise returns
false
.
另请参阅
operator!=()
PySide2.QtSql.QSqlRecord.
remove
(
pos
)
¶
pos
–
int
Removes the field at position
pos
。若
pos
is out of range, nothing happens.
PySide2.QtSql.QSqlRecord.
replace
(
pos
,
field
)
¶
pos
–
int
field
–
QSqlField
Replaces the field at position
pos
采用给定
field
。若
pos
is out of range, nothing happens.
PySide2.QtSql.QSqlRecord.
setGenerated
(
name
,
generated
)
¶
name – unicode
generated
–
bool
PySide2.QtSql.QSqlRecord.
setGenerated
(
i
,
generated
)
¶
i
–
int
generated
–
bool
这是重载函数。
Sets the generated flag for the field
index
to
generated
.
另请参阅
PySide2.QtSql.QSqlRecord.
setNull
(
name
)
¶
name – unicode
PySide2.QtSql.QSqlRecord.
setNull
(
i
)
¶
i
–
int
Sets the value of field
index
to null. If the field does not exist, nothing happens.
另请参阅
PySide2.QtSql.QSqlRecord.
setValue
(
name
,
val
)
¶
name – unicode
val – object
PySide2.QtSql.QSqlRecord.
setValue
(
i
,
val
)
¶
i
–
int
val – object
PySide2.QtSql.QSqlRecord.
value
(
name
)
¶
name – unicode
object
PySide2.QtSql.QSqlRecord.
value
(
i
)
¶
i
–
int
object
Returns the value of the field located at position
index
in the record. If
index
is out of bounds, an invalid
QVariant
被返回。