本文整理汇总了C++中QSqlRecord::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QSqlRecord::isNull方法的具体用法?C++ QSqlRecord::isNull怎么用?C++ QSqlRecord::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSqlRecord
的用法示例。
在下文中一共展示了QSqlRecord::isNull方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isNull
bool QSqlRecordProto::isNull(int index) const
{
QSqlRecord *item = qscriptvalue_cast<QSqlRecord*>(thisObject());
if (item)
return item->isNull(index);
return false;
}
示例2: insertRowIntoTable
bool PoitemTableModel::insertRowIntoTable(const QSqlRecord& record)
{
if (record.isEmpty())
return true;
bool isNull = true;
for (int i = 0; i < record.count(); i++)
{
if (i == record.indexOf("poitem_pohead_id") ||
(record.value(i).toString().isEmpty() &&
(i == record.indexOf("poitem_status") ||
i == record.indexOf("poitem_vend_item_descrip") ||
i == record.indexOf("poitem_vend_uom") ||
i == record.indexOf("poitem_vend_item_number") ||
i == record.indexOf("poitem_comments") )))
continue;
isNull &= record.isNull(i);
}
if (isNull)
return true;
QSqlRecord newRecord(record);
if (! validRow(newRecord))
return false;
return QSqlRelationalTableModel::insertRowIntoTable(newRecord);
}
示例3: onItemSelected
void TextField::onItemSelected(QSqlRecord record)
{
QString tableIdentifier = record.value("key").toString().right(1);
if (!record.isNull(fieldName) && tableIdentifier == this->tableIdentifier) {
setText(record.value(fieldName).toString());
}
}
示例4: exec
bool QSqlTableModelPrivate::exec(const QString &stmt, bool prepStatement,
const QSqlRecord &rec, const QSqlRecord &whereValues)
{
if (stmt.isEmpty())
return false;
// lazy initialization of editQuery
if (editQuery.driver() != db.driver())
editQuery = QSqlQuery(db);
// workaround for In-Process databases - remove all read locks
// from the table to make sure the editQuery succeeds
if (db.driver()->hasFeature(QSqlDriver::SimpleLocking))
const_cast<QSqlResult *>(query.result())->detachFromResultSet();
if (prepStatement) {
if (editQuery.lastQuery() != stmt) {
if (!editQuery.prepare(stmt)) {
error = editQuery.lastError();
return false;
}
}
int i;
for (i = 0; i < rec.count(); ++i) {
if (rec.isGenerated(i))
editQuery.addBindValue(rec.value(i));
}
for (i = 0; i < whereValues.count(); ++i) {
if (whereValues.isGenerated(i) && !whereValues.isNull(i))
editQuery.addBindValue(whereValues.value(i));
}
if (!editQuery.exec()) {
error = editQuery.lastError();
return false;
}
} else {
if (!editQuery.exec(stmt)) {
error = editQuery.lastError();
return false;
}
}
return true;
}
示例5: agregarServicio
/*!
\fn MPeluqueria::agregarServicio( QVariant desc, QVariant precio, QVariant fecha, QVariant id_mascota )
*/
bool MPeluqueria::agregarServicio( QVariant desc, QVariant precio, QVariant fecha, QVariant id_mascota )
{
/* if( !mascota.isValid() )
{
qDebug( "Inidce Mascota es invalido" );
return false;
}
QVariant id_mascota = relationModel( 1 )->data( mascota, 0 );
if( id_mascota.isValid() && id_mascota.toInt() <= 0 )
{return false;}*/
QSqlRecord registro = record();
registro.setValue( 1, id_mascota );
registro.setValue( 2, desc );
registro.setValue( 3, precio );
registro.setValue( 4, fecha );
for( int i = 0; i<registro.count(); i++ )
{
qDebug( QString( "Campo: %1, generado? %2, null? %3, valor? |%4|" ).arg( registro.fieldName( i ) ).arg( registro.isGenerated( i ) ).arg( registro.isNull( i ) ).arg( registro.value( i ).toString() ).toLocal8Bit() );
}
if( insertRecord( -1, registro ) )
{
qDebug( "Registro de servicio agregado correctamente" );
return true;
}
else
{
qDebug( "Error al insertar registro de servicio de mascota" );
qDebug( QString( "Detalles: tipo: %1, errno: %2, descripcion: %3" ).arg( lastError().type() ).arg( lastError().number() ).arg( lastError().text() ).toLocal8Bit() );
return false;
}
}