View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013705VTK(No Category)public2012-12-05 17:222013-07-22 20:57
ReporterPatrick Emond 
Assigned ToDave DeMarle 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version6.1.0 
Summary0013705: vtkMySQLQuery incorrectly returning non NULL values in certain circumstances
DescriptionWhen 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.
TagsNo tags attached.
ProjectTBD
Typeincorrect functionality
Attached Files

 Relationships

  Notes
(0031059)
Dave DeMarle (administrator)
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 (reporter)
2013-06-26 10:39

Thanks for the link, the instructions were nice and easy to follow. Patch submitted.
(0031085)
Dave DeMarle (administrator)
2013-06-26 10:43

Added relevant developers to: http://review.source.kitware.com/#/c/11753/ [^]

Thanks Patrick!

 Issue History
Date Modified Username Field Change
2012-12-05 17:22 Patrick Emond New Issue
2013-06-25 14:00 Dave DeMarle Note Added: 0031059
2013-06-26 10:39 Patrick Emond Note Added: 0031084
2013-06-26 10:43 Dave DeMarle Note Added: 0031085
2013-07-22 20:56 Dave DeMarle Assigned To => Dave DeMarle
2013-07-22 20:56 Dave DeMarle Status backlog => todo
2013-07-22 20:57 Dave DeMarle Status todo => active development
2013-07-22 20:57 Dave DeMarle Status active development => closed
2013-07-22 20:57 Dave DeMarle Resolution open => fixed
2013-07-22 20:57 Dave DeMarle Fixed in Version => 6.1.0


Copyright © 2000 - 2018 MantisBT Team