MantisBT - VTK
View Issue Details
0013705VTK(No Category)public2012-12-05 17:222013-07-22 20:57
Patrick Emond 
Dave DeMarle 
normalminorhave not tried
closedfixed 
 
6.1.0 
TBD
incorrect functionality
0013705: vtkMySQLQuery incorrectly returning non NULL values in certain circumstances
When querying a table which has columns which may be null this class returns non-null values when it shouldn't. For instance, for the table:

CREATE TABLE myTable (
  myIntValue int DEFAULT NULL,
  myFloatValue float DEFAULT NULL
)

columns myIntValue and myFloatValue may be set to null, but when reading these values using vtkMySQLQuery the values 0 and 0.0 are returned instead of NULL.

The reason is found in vtkMySQLQuery::DataValue Specifically, in the switch statement there are several return statements which do the following:

return vtkVariant(base.ToInt());

When the value is NULL the variable "base" is correctly set to an un-initialized state. Calling ToInt() returns 0 even if it is not a valid number (NULL), so instead this line should read:

return base.IsValid() ? vtkVariant(base.ToInt()) : base;

The same could be applied for long, floats and doubles.
No tags attached.
Issue History
2012-12-05 17:22Patrick EmondNew Issue
2013-06-25 14:00Dave DeMarleNote Added: 0031059
2013-06-26 10:39Patrick EmondNote Added: 0031084
2013-06-26 10:43Dave DeMarleNote Added: 0031085
2013-07-22 20:56Dave DeMarleAssigned To => Dave DeMarle
2013-07-22 20:56Dave DeMarleStatusbacklog => todo
2013-07-22 20:57Dave DeMarleStatustodo => active development
2013-07-22 20:57Dave DeMarleStatusactive development => closed
2013-07-22 20:57Dave DeMarleResolutionopen => fixed
2013-07-22 20:57Dave DeMarleFixed in Version => 6.1.0

Notes
(0031059)
Dave DeMarle   
2013-06-25 14:00   
Mind submitting that patch in gerrit to facilitate automated testing and review?
For details on how to do so see http://www.vtk.org/Wiki/VTK/Git/Develop [^]
(0031084)
Patrick Emond   
2013-06-26 10:39   
Thanks for the link, the instructions were nice and easy to follow. Patch submitted.
(0031085)
Dave DeMarle   
2013-06-26 10:43   
Added relevant developers to: http://review.source.kitware.com/#/c/11753/ [^]

Thanks Patrick!