[vtk-developers] [VTK 0013705]: vtkMySQLQuery incorrectly returning	non NULL values in certain circumstances
    Mantis Bug Tracker 
    mantis at public.kitware.com
       
    Wed Dec  5 17:22:24 EST 2012
    
    
  
The following issue has been SUBMITTED. 
====================================================================== 
http://www.vtk.org/Bug/view.php?id=13705 
====================================================================== 
Reported By:                Patrick Emond
Assigned To:                
====================================================================== 
Project:                    VTK
Issue ID:                   13705
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     backlog
Project:                    TBD 
Type:                       incorrect functionality 
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             2012-12-05 17:22 EST
Last Modified:              2012-12-05 17:22 EST
====================================================================== 
Summary:                    vtkMySQLQuery incorrectly returning non NULL values
in certain circumstances
Description: 
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.
====================================================================== 
Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-12-05 17:22 Patrick Emond  New Issue                                    
======================================================================
    
    
More information about the vtk-developers
mailing list