Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QgsVectorDataProvider::supportedType(): only checks field length and …
…precision against min/max if they are defined (ie > 0). Fixes test_qgsauxiliarystorage.py and qgis_projectstoragetest
  • Loading branch information
rouault authored and slarosa committed Jul 6, 2018
1 parent 00c301e commit e715b91
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/core/qgsvectordataprovider.cpp
Expand Up @@ -309,16 +309,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 @@ -329,18 +320,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 e715b91

Please sign in to comment.