Commit edbde0eb authored by Philippe Pebay's avatar Philippe Pebay
Browse files

BUG: fixed a leak.

parent ae9f15c6
...@@ -39,7 +39,7 @@ PURPOSE. See the above copyright notice for more information. ...@@ -39,7 +39,7 @@ PURPOSE. See the above copyright notice for more information.
#include <vtksys/SystemTools.hxx> #include <vtksys/SystemTools.hxx>
#include <vtksys/ios/sstream> #include <vtksys/ios/sstream>
vtkCxxRevisionMacro(vtkSQLDatabase, "1.32"); vtkCxxRevisionMacro(vtkSQLDatabase, "1.33");
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
vtkSQLDatabase::vtkSQLDatabase() vtkSQLDatabase::vtkSQLDatabase()
...@@ -364,6 +364,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -364,6 +364,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
if ( numCol < 0 ) if ( numCol < 0 )
{ {
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
...@@ -388,6 +389,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -388,6 +389,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
else // if ( colStr.size() ) else // if ( colStr.size() )
{ {
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
} }
...@@ -398,6 +400,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -398,6 +400,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
if ( numIdx < 0 ) if ( numIdx < 0 )
{ {
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
for ( int idxHandle = 0; idxHandle < numIdx; ++ idxHandle ) for ( int idxHandle = 0; idxHandle < numIdx; ++ idxHandle )
...@@ -420,6 +423,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -420,6 +423,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
else // if ( idxStr.size() ) else // if ( idxStr.size() )
{ {
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
} }
...@@ -432,6 +436,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -432,6 +436,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
vtkGenericWarningMacro( "Unable to effect the schema: unable to execute query.\nDetails: " vtkGenericWarningMacro( "Unable to effect the schema: unable to execute query.\nDetails: "
<< query->GetLastErrorText() ); << query->GetLastErrorText() );
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
} }
...@@ -446,6 +451,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -446,6 +451,7 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
vtkGenericWarningMacro( "Unable to effect the schema: unable to execute query.\nDetails: " vtkGenericWarningMacro( "Unable to effect the schema: unable to execute query.\nDetails: "
<< query->GetLastErrorText() ); << query->GetLastErrorText() );
query->RollbackTransaction(); query->RollbackTransaction();
query->Delete();
return false; return false;
} }
} }
...@@ -457,9 +463,11 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis ...@@ -457,9 +463,11 @@ bool vtkSQLDatabase::EffectSchema( vtkSQLDatabaseSchema* schema, bool dropIfExis
{ {
vtkGenericWarningMacro( "Unable to effect the schema: unable to commit transaction.\nDetails: " vtkGenericWarningMacro( "Unable to effect the schema: unable to commit transaction.\nDetails: "
<< query->GetLastErrorText() ); << query->GetLastErrorText() );
query->Delete();
return false; return false;
} }
query->Delete();
return true; return true;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment