Skip to content

Commit

Permalink
QgsVectorDataProvider::supportedType(): only checks field length and …
Browse files Browse the repository at this point in the history
…precision against min/max if they are defined (ie > 0). Fixes test_qgsauxiliarystorage.py and qgis_projectstoragetest
  • Loading branch information
rouault committed Jun 1, 2018
1 parent a3e527d commit b9003ff
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/core/qgsvectordataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,7 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
if ( field.type() != nativeType.mType )
continue;

if ( field.length() <= 0 )
{
// source length unlimited
if ( nativeType.mMinLen > 0 || nativeType.mMaxLen > 0 )
{
// destination limited
continue;
}
}
else
if ( field.length() > 0 )
{
// source length limited
if ( ( nativeType.mMinLen > 0 && field.length() < nativeType.mMinLen ) ||
Expand All @@ -363,18 +354,9 @@ bool QgsVectorDataProvider::supportedType( const QgsField &field ) const
}
}

if ( field.precision() <= 0 )
{
// source precision unlimited / n/a
if ( nativeType.mMinPrec > 0 || nativeType.mMaxPrec > 0 )
{
// destination limited
continue;
}
}
else
if ( field.precision() > 0 )
{
// source precision unlimited / n/a
// source precision limited
if ( ( nativeType.mMinPrec > 0 && field.precision() < nativeType.mMinPrec ) ||
( nativeType.mMaxPrec > 0 && field.precision() > nativeType.mMaxPrec ) )
{
Expand Down

0 comments on commit b9003ff

Please sign in to comment.