mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
[oracle] Fix handling of type null variants
This commit is contained in:
parent
dd11d8acf1
commit
398fc2c30a
@ -1394,10 +1394,16 @@ bool QgsOracleProvider::addFeatures( QgsFeatureList &flist, QgsFeatureSink::Flag
|
||||
QVariant value = attributevec.value( fieldId[i], QVariant() );
|
||||
|
||||
QgsField fld = field( fieldId[i] );
|
||||
if ( ( value.isNull() && mPrimaryKeyAttrs.contains( i ) && !defaultValues.at( i ).isEmpty() ) || ( value.toString() == defaultValues[i] ) )
|
||||
if ( ( QgsVariantUtils::isNull( value ) && mPrimaryKeyAttrs.contains( i ) && !defaultValues.at( i ).isEmpty() ) || ( value.toString() == defaultValues[i] ) )
|
||||
{
|
||||
value = evaluateDefaultExpression( defaultValues[i], fld.type() );
|
||||
}
|
||||
else if ( QgsVariantUtils::isNull( value ) )
|
||||
{
|
||||
// don't use typed null variants, always use invalid variants. Otherwise the connection
|
||||
// may incorrectly try to coerce a null value to the variant type
|
||||
value = QVariant();
|
||||
}
|
||||
features->setAttribute( fieldId[i], value );
|
||||
|
||||
QgsDebugMsgLevel( QStringLiteral( "addBindValue: %1" ).arg( value.toString() ), 4 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user