Re: [QGIS-Developer] set unspecified precision -1 on double in spatiaLite and org providers

2018-01-12 Thread Matthias Kuhn
Hi Dave,

the proposal is that

QgsFields::precision() always returns -1 for doubles, correct?

Sounds fine to me, 0 might be a real value (0 digits after the decimal
point) while -1 clearly indicates an arbitrary precision (as in double).

Matthias


On 01/09/2018 03:34 PM, David Signer wrote:
> Hi all
>
> We found different behaviors in qgsorgprovider and
> qgsspatialiteprovider regarding the field with the type double.
> In `QgsSpatiaLiteProvider::convertField` it's set to -1 when it's 0 :
> https://github.com/qgis/QGIS/blob/master/src/providers/spatialite/qgsspatialiteprovider.cpp#L82-L88
> That's why I decided to change it in
> `QgsSpatiaLiteProvider::loadFieldsAbstractInterface` as well. The
> advantage would be, that we could recognize a field with type double
> when the precision is not zero.
> But when I checked qgsorgprovider, in `QgsOgrProvider::convertField`
> the precision is not set (stays what it is) in case of double:
> https://github.com/qgis/QGIS/blob/master/src/providers/ogr/qgsogrprovider.cpp#L143-L145
> I wonder why it's different and I ask you, if you mind, when we just
> set the precision in any case to -1 when it's a double value and it's
> not specified (means 0)?
>
> ThanksĀ 
> Dave
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] set unspecified precision -1 on double in spatiaLite and org providers

2018-01-09 Thread David Signer

Hi all  
  
We found different behaviors in qgsorgprovider and qgsspatialiteprovider 
regarding the field with the type double.  
In  `QgsSpatiaLiteProvider::convertField` it's set to -1 when it's 0 : 
[https://github.com/qgis/QGIS/blob/master/src/providers/spatialite/qgsspatialiteprovider.cpp#L82-L88](https://github.com/qgis/QGIS/blob/master/src/providers/spatialite/qgsspatialiteprovider.cpp#L82-L88)
  
That's why I decided to change it in 
`QgsSpatiaLiteProvider::loadFieldsAbstractInterface` as well. The advantage 
would be, that we could recognize a field with type double when the precision 
is not zero.  
But when I checked qgsorgprovider, in  `QgsOgrProvider::convertField` the 
precision is not set (stays what it is) in case of double: 
[https://github.com/qgis/QGIS/blob/master/src/providers/ogr/qgsogrprovider.cpp#L143-L145](https://github.com/qgis/QGIS/blob/master/src/providers/ogr/qgsogrprovider.cpp#L143-L145)
  
I wonder why it's different and I ask you, if you mind, when we just set the 
precision in any case to -1 when  it's a double value and it's not specified 
(means 0)?  
  
ThanksĀ   
Dave  

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer