File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,9 @@ bool QgsAttributeForm::save()
161
161
{
162
162
QVariant dstVar = dst[eww->fieldIdx ()];
163
163
QVariant srcVar = eww->value ();
164
- if ( dstVar != srcVar && srcVar.isValid () )
164
+ // need to check dstVar.isNull() != srcVar.isNull()
165
+ // otherwise if dstVar=NULL and scrVar=0, then dstVar = srcVar
166
+ if ( ( dstVar != srcVar || dstVar.isNull () != srcVar.isNull () ) && srcVar.isValid () )
165
167
{
166
168
dst[eww->fieldIdx ()] = srcVar;
167
169
@@ -199,7 +201,7 @@ bool QgsAttributeForm::save()
199
201
int n = 0 ;
200
202
for ( int i = 0 ; i < dst.count (); ++i )
201
203
{
202
- if ( dst[i] == src[i] || !dst[i].isValid () )
204
+ if ( ( dst[i] == src[i] && dst[i]. isNull () == src[i]. isNull () ) || !dst[i].isValid () )
203
205
{
204
206
QgsDebugMsg ( " equal or invalid destination" );
205
207
QgsDebugMsg ( QString ( " dst:'%1' (type:%2,isNull:%3,isValid:%4)" )
Original file line number Diff line number Diff line change @@ -2024,7 +2024,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
2024
2024
}
2025
2025
else
2026
2026
{
2027
- sql += quotedValue ( siter-> toString () );
2027
+ sql += quotedValue ( * siter );
2028
2028
}
2029
2029
}
2030
2030
catch ( PGFieldNotFound )
You can’t perform that action at this time.
0 commit comments