[fdo-commits] r2703 - in trunk: Providers/GenericRdbms/Inc/Rdbi
Providers/GenericRdbms/Src/MySQL/Driver
Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph
Providers/GenericRdbms/Src/Rdbi
Providers/GenericRdbms/Src/UnitTest/Common
Providers/GenericRdbms/Src/UnitTest/MySql
Utilities/SchemaMgr/Src/Sm/Ph
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Wed Mar 21 16:54:55 EDT 2007
Author: romicadascalescu
Date: 2007-03-21 16:54:55 -0400 (Wed, 21 Mar 2007)
New Revision: 2703
Modified:
trunk/Providers/GenericRdbms/Inc/Rdbi/proto.h
trunk/Providers/GenericRdbms/Src/MySQL/Driver/fetch.c
trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c
trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnGeom.cpp
trunk/Providers/GenericRdbms/Src/Rdbi/disconnect.c
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.cpp
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.h
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationUpdateTest.h
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp
trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp
trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoInsertTest.cpp
trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp
trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp
Log:
Ticket #48 Fixed some memory leaks on MySQL provider
Modified: trunk/Providers/GenericRdbms/Inc/Rdbi/proto.h
===================================================================
--- trunk/Providers/GenericRdbms/Inc/Rdbi/proto.h 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Inc/Rdbi/proto.h 2007-03-21 20:54:55 UTC (rev 2703)
@@ -499,6 +499,7 @@
int rdbi_autocommit_on (rdbi_context_def *context);
int rdbi_autocommit_off (rdbi_context_def *context);
int rdbi_autocommit_mode (rdbi_context_def *context);
+int rdbi_free_all(rdbi_context_def *context);
#endif /* INC_RDBI_PROTO_H */
Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/fetch.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/fetch.c 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/fetch.c 2007-03-21 20:54:55 UTC (rev 2703)
@@ -36,6 +36,7 @@
{
FreeGeometry (cursor->redefines[i].geometry);
cursor->redefines[i].geometry = (void*)NULL;
+ *((char**)(cursor->redefines[i].original)) = NULL;
}
if (0 != *(cursor->defines[i].is_null))
*((char**)(cursor->redefines[i].original)) = NULL;
@@ -97,7 +98,8 @@
// helps the caller to handle the TEXT columns.
unsigned long *size = curs->defines[i].length;
char *address = (char *)curs->defines[i].buffer;
- address[*size] = '\0';
+ if (curs->redefines == NULL || curs->redefines[i].orig_type != MYSQL_TYPE_GEOMETRY)
+ address[*size] = '\0';
}
}
Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/fre_cursor.c 2007-03-21 20:54:55 UTC (rev 2703)
@@ -30,9 +30,9 @@
for (i = 0; i < cursor->define_count; i++)
if ((void*)NULL != cursor->redefines[i].geometry)
{
-#pragma message ("ToDo: Investigate why it leads to a crash in case the geometry is released.")
- // FreeGeometry (cursor->redefines[i].geometry);
+ FreeGeometry (cursor->redefines[i].geometry);
cursor->redefines[i].geometry = (void*)NULL;
+ *((char**)(cursor->redefines[i].original)) = NULL;
}
free (cursor->redefines);
cursor->redefines = (mysql_define_def *)NULL;
Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnGeom.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnGeom.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnGeom.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -38,6 +38,7 @@
mSRID = gdbiResult->GetInt64(L"srid", NULL, NULL);
}
gdbiResult->End();
+ delete gdbiResult;
}
return mSRID;
}
Modified: trunk/Providers/GenericRdbms/Src/Rdbi/disconnect.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/Rdbi/disconnect.c 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/Rdbi/disconnect.c 2007-03-21 20:54:55 UTC (rev 2703)
@@ -51,6 +51,7 @@
#include <Inc/Nls/rdbi_msg.h>
#include <Inc/debugext.h>
#include <Inc/ut.h> /* ut_vm_free() */
+#include <Inc/Rdbi/proto.h>
#include <Inc/Rdbi/context.h>
#include "global.h" /* rdbi global area */
@@ -74,6 +75,7 @@
}
}
+ rdbi_free_all(context);
context->rdbi_last_status = (*(context->dispatch.disconnect))(context->drvr, &context->rdbi_cnct->vendor_data);
context->rdbi_cnct->in_use = FALSE; /* mark as available */
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoApplySchemaTest.h 2007-03-21 20:54:55 UTC (rev 2703)
@@ -46,12 +46,12 @@
virtual void set_provider() {};
static FdoPropertyValue* AddNewProperty( FdoPropertyValueCollection* propertyValues, const wchar_t *name );
- void TestSchema ();
- void TestOverrides ();
- void TestOverrideDefaults ();
- void TestOverrideErrors ();
- void TestLT();
- void TestConfigDoc();
+ virtual void TestSchema ();
+ virtual void TestOverrides ();
+ virtual void TestOverrideDefaults ();
+ virtual void TestOverrideErrors ();
+ virtual void TestLT();
+ virtual void TestConfigDoc();
void DeleteAcadSchema( FdoIConnection* connection );
void DeleteLandSchema( FdoIConnection* connection );
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -55,6 +55,7 @@
pDelCmd->Execute();
connection->Close();
}
+ catch(FdoException* e) {e->Release();}
catch(...) { }
UnitTestUtil::CreateDB(false, false, DB_SUFFIX);
@@ -87,13 +88,15 @@
//
// (re)create the schema
// FdoPtr<FdoFeatureSchemaCollection> pSchemas = FdoFeatureSchemaCollection::Create(NULL);
- FdoFeatureSchema* pTestSchema = FdoFeatureSchema::Create( L"AssociationSchema", L"Test Association schema" );
+ FdoPtr<FdoFeatureSchema> pTestSchema = FdoFeatureSchema::Create( L"AssociationSchema", L"Test Association schema" );
// pSchemas->Add( pTestSchema );
- FdoClassDefinition* pfeatureclass;
+ FdoPtr<FdoClassDefinition> pfeatureclass;
FdoPtr<FdoDataPropertyDefinition> pProp;
// Create a feature class
+ FdoPtr<FdoPropertyDefinitionCollection> propDefColl;
+ FdoPtr<FdoDataPropertyDefinitionCollection> propDataDefColl;
if( ownerIsFeat )
{
pfeatureclass = FdoFeatureClass::Create(L"TestFeatureClass", L"FeatureClass Desc");
@@ -102,8 +105,10 @@
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass->GetIdentityProperties())->Add( pProp );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pfeatureclass->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
}
else
{
@@ -111,24 +116,28 @@
pProp = FdoDataPropertyDefinition::Create( L"Id", L"Id Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass->GetIdentityProperties())->Add( pProp );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pfeatureclass->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
}
// Add first name and last name properties
pProp = FdoDataPropertyDefinition::Create( L"First Name", L"First Name" );
pProp->SetDataType( FdoDataType_String );
pProp->SetLength(32);
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( pProp );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"Last Name", L"Last Name" );
pProp->SetDataType( FdoDataType_String );
pProp->SetLength(32);
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( pProp );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( pProp );
// Create a class
- FdoClassDefinition* pclass;
+ FdoPtr<FdoClassDefinition> pclass;
if( associatedIsFeat )
{
pclass = FdoFeatureClass::Create(L"TestClass", L"Class Desc");
@@ -136,8 +145,10 @@
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pclass->GetIdentityProperties())->Add( pProp );
+ propDefColl = pclass->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pclass->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
}
else
{
@@ -146,63 +157,75 @@
pProp = FdoDataPropertyDefinition::Create( L"Id", L"Id Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pclass->GetIdentityProperties())->Add( pProp );
+ propDefColl = pclass->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pclass->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
}
// Add name one and name two properties
pProp = FdoDataPropertyDefinition::Create( L"Name One", L"Name One" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->Add( pProp );
+ propDefColl = pclass->GetProperties();
+ propDefColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"Name Two", L"Name Two" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->Add( pProp );
+ propDefColl = pclass->GetProperties();
+ propDefColl->Add( pProp );
// Create a class
- FdoClass* pclassLeafObj = FdoClass::Create(L"TestSuperObjClass", L"Obj Class Desc");
+ FdoPtr<FdoClass> pclassLeafObj = FdoClass::Create(L"TestSuperObjClass", L"Obj Class Desc");
// Add identity property
pProp = FdoDataPropertyDefinition::Create( L"Id", L"ObjId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassLeafObj->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pclassLeafObj->GetIdentityProperties())->Add( pProp );
+ propDefColl = pclassLeafObj->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pclassLeafObj->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
// Add name one and name two properties
pProp = FdoDataPropertyDefinition::Create( L"First Name", L"Name One" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassLeafObj->GetProperties())->Add( pProp );
+ propDefColl = pclassLeafObj->GetProperties();
+ propDefColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"Last Name", L"Name Two" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassLeafObj->GetProperties())->Add( pProp );
+ propDefColl = pclassLeafObj->GetProperties();
+ propDefColl->Add( pProp );
// Create a class
- FdoClass* pclassObj = FdoClass::Create(L"TestOC", L"Obj Class Desc");
+ FdoPtr<FdoClass> pclassObj = FdoClass::Create(L"TestOC", L"Obj Class Desc");
// Add identity property
pProp = FdoDataPropertyDefinition::Create( L"Id", L"ObjId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassObj->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pclassObj->GetIdentityProperties())->Add( pProp );
+ propDefColl = pclassObj->GetProperties();
+ propDefColl->Add( pProp );
+ propDataDefColl = pclassObj->GetIdentityProperties();
+ propDataDefColl->Add( pProp );
// Add name one and name two properties
pProp = FdoDataPropertyDefinition::Create( L"First Name", L"Name One" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassObj->GetProperties())->Add( pProp );
+ propDefColl = pclassObj->GetProperties();
+ propDefColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"Last Name", L"Name Two" );
pProp->SetDataType( FdoDataType_String );
pProp->SetNullable(false);
pProp->SetLength(32);
- FdoPtr<FdoPropertyDefinitionCollection>(pclassObj->GetProperties())->Add( pProp );
+ propDefColl = pclassObj->GetProperties();
+ propDefColl->Add( pProp );
// Create a feature Sub class class
- FdoClassDefinition* pSubFeatureclass;
+ FdoPtr<FdoClassDefinition> pSubFeatureclass;
if( ownerIsFeat )
{
pSubFeatureclass = FdoFeatureClass::Create(L"TestSubFeatureClass", L"A subclass from a featureClass");
@@ -212,7 +235,8 @@
pProp = FdoDataPropertyDefinition::Create( L"Id", L"An Id Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pSubFeatureclass->GetProperties())->Add( pProp );
+ propDefColl = pSubFeatureclass->GetProperties();
+ propDefColl->Add( pProp );
}
else
{
@@ -220,11 +244,12 @@
pSubFeatureclass->SetBaseClass( pfeatureclass );
}
// Add the classes to the schema class collection
- FdoClassesP(pTestSchema->GetClasses())->Add( pfeatureclass );
- FdoClassesP(pTestSchema->GetClasses())->Add( pclass );
- FdoClassesP(pTestSchema->GetClasses())->Add( pclassLeafObj );
- FdoClassesP(pTestSchema->GetClasses())->Add( pclassObj );
- FdoClassesP(pTestSchema->GetClasses())->Add( pSubFeatureclass );
+ FdoClassesP clsColl = pTestSchema->GetClasses();
+ clsColl->Add( pfeatureclass );
+ clsColl->Add( pclass );
+ clsColl->Add( pclassLeafObj );
+ clsColl->Add( pclassObj );
+ clsColl->Add( pSubFeatureclass );
// Create a valid association property
@@ -237,24 +262,16 @@
passprop->SetReverseMultiplicity(L"1");
if( useIdent )
{
- FdoPtr<FdoDataPropertyDefinition> pprop = (FdoDataPropertyDefinition*)FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->GetItem( L"Name One" );
- FdoPtr<FdoDataPropertyDefinitionCollection>(passprop->GetIdentityProperties())->Add( pprop );
+ propDefColl = pclass->GetProperties();
+ propDataDefColl = passprop->GetIdentityProperties();
+ FdoPtr<FdoDataPropertyDefinition> pprop = (FdoDataPropertyDefinition*)propDefColl->GetItem( L"Name One" );
+ propDataDefColl->Add( pprop );
- FdoPtr<FdoDataPropertyDefinitionCollection>(passprop->GetIdentityProperties())->Add(
- FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->GetItem( L"Name Two" )
- )
- );
- FdoPtr<FdoDataPropertyDefinitionCollection>(passprop->GetReverseIdentityProperties())->Add(
- FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->GetItem( L"First Name" )
- )
- );
- FdoPtr<FdoDataPropertyDefinitionCollection>(passprop->GetReverseIdentityProperties())->Add(
- FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->GetItem( L"Last Name" )
- )
- );
+ propDataDefColl->Add( FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)propDefColl->GetItem( L"Name Two" )));
+ propDefColl = pfeatureclass->GetProperties();
+ propDataDefColl = passprop->GetReverseIdentityProperties();
+ propDataDefColl->Add( FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)propDefColl->GetItem( L"First Name" )));
+ propDataDefColl->Add( FdoPtr<FdoDataPropertyDefinition>( (FdoDataPropertyDefinition*)propDefColl->GetItem( L"Last Name" )));
}
passprop->SetAssociatedClass(pclass);
@@ -276,13 +293,15 @@
// Add the association property to the feature class property collection
if( addToSubclass )
{
- FdoPtr<FdoPropertyDefinitionCollection>(pSubFeatureclass->GetProperties())->Add( passprop );
- FdoPtr<FdoPropertyDefinitionCollection>(pSubFeatureclass->GetProperties())->Add( passprop2 );
+ propDefColl = pSubFeatureclass->GetProperties();
+ propDefColl->Add( passprop );
+ propDefColl->Add( passprop2 );
}
else
{
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( passprop );
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( passprop2 );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( passprop );
+ propDefColl->Add( passprop2 );
}
}
else
@@ -290,30 +309,28 @@
if( useNestedObj )
{
// Add the association property to the leaf class of the obj class
- FdoPtr<FdoPropertyDefinitionCollection>(pclassLeafObj->GetProperties())->Add( passprop );
+ propDefColl = pclassLeafObj->GetProperties();
+ propDefColl->Add( passprop );
FdoPtr<FdoObjectPropertyDefinition>pLeafObjPropData = FdoObjectPropertyDefinition::Create( L"LeafObject", L"object property" );
pLeafObjPropData->SetClass( pclassLeafObj );
pLeafObjPropData->SetObjectType( FdoObjectType_Value );
- FdoPtr<FdoPropertyDefinitionCollection>(pclassObj->GetProperties())->Add( pLeafObjPropData );
+ propDefColl = pclassObj->GetProperties();
+ propDefColl->Add( pLeafObjPropData );
}
else
{
// Add the association property to the Obj class property collection
- FdoPtr<FdoPropertyDefinitionCollection>(pclassObj->GetProperties())->Add( passprop );
+ propDefColl = pclassObj->GetProperties();
+ propDefColl->Add( passprop );
}
// Add an object property that contain an association
FdoPtr<FdoObjectPropertyDefinition>pObjPropData = FdoObjectPropertyDefinition::Create( L"Object", L"object property" );
pObjPropData->SetClass( pclassObj );
pObjPropData->SetObjectType( FdoObjectType_Value );
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass->GetProperties())->Add( pObjPropData );
+ propDefColl = pfeatureclass->GetProperties();
+ propDefColl->Add( pObjPropData );
}
- pclassObj->Release();
- pSubFeatureclass->Release();
- pclassLeafObj->Release();
- pclass->Release();
- pfeatureclass->Release();
-
FdoPtr<FdoIApplySchema>pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
pCmd->SetFeatureSchema( pTestSchema );
@@ -330,8 +347,6 @@
}
}
- pTestSchema->Release();
-
}
catch ( FdoSchemaException* e )
{
@@ -355,6 +370,7 @@
FdoPtr<FdoFeatureSchema> schema = pfsc->GetItem(L"AssociationSchema");
FdoPtr<FdoClassCollection> classes = schema->GetClasses();
FdoPtr<FdoClassDefinition> cls;
+ FdoPtr<FdoClassDefinition> ascClass;
cls = classes->GetItem(L"TestFeatureClass");
if( cls )
@@ -368,9 +384,10 @@
propCol = cls->GetProperties();
}
prop = (FdoAssociationPropertyDefinition*)propCol->GetItem(L"Association Prop1");
+ ascClass = prop->GetAssociatedClass();
printf("Association: name(%ls) associated class(%ls) multiplicity(%ls)\n",
prop->GetName(),
- (FdoPtr<FdoClassDefinition>(prop->GetAssociatedClass()))->GetName(),
+ ascClass->GetName(),
prop->GetMultiplicity() );
FdoPtr<FdoDataPropertyDefinitionCollection> identProps = prop->GetIdentityProperties();
printf("Identity properties: \n");
@@ -397,14 +414,15 @@
{
FdoPtr<FdoObjectPropertyDefinition> objProp = (FdoObjectPropertyDefinition*)propCol->GetItem(L"Object");
cls = objProp->GetClass();
- prop = (FdoAssociationPropertyDefinition*)cls->GetProperties()->GetItem(L"Association Prop1");
+ FdoPtr<FdoPropertyDefinitionCollection> propsDefColl = cls->GetProperties();
+ prop = (FdoAssociationPropertyDefinition*)propsDefColl->GetItem(L"Association Prop1");
}
else
prop = (FdoAssociationPropertyDefinition*)propCol->GetItem(L"Association Prop1");
-
+ ascClass = prop->GetAssociatedClass();
printf("Association: name(%ls) associated class(%ls) multiplicity(%ls)\n",
prop->GetName(),
- (FdoPtr<FdoClassDefinition>(prop->GetAssociatedClass()))->GetName(),
+ ascClass->GetName(),
prop->GetMultiplicity() );
FdoPtr<FdoDataPropertyDefinitionCollection> identProps = prop->GetIdentityProperties();
printf("Identity properties: \n");
@@ -498,59 +516,74 @@
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass1->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass1->GetIdentityProperties())->Add( pProp );
+ FdoPtr<FdoPropertyDefinitionCollection> propsColl = pfeatureclass1->GetProperties();
+ propsColl->Add( pProp );
+ FdoPtr<FdoDataPropertyDefinitionCollection> propsIdColl = pfeatureclass1->GetIdentityProperties();
+ propsIdColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"FeatId", L"FeatId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass2->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass2->GetIdentityProperties())->Add( pProp );
+ propsColl = pfeatureclass2->GetProperties();
+ propsColl->Add( pProp );
+ propsIdColl = pfeatureclass2->GetIdentityProperties();
+ propsIdColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"FeatId", L"FeatId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass3->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass3->GetIdentityProperties())->Add( pProp );
+ propsColl = pfeatureclass3->GetProperties();
+ propsColl->Add( pProp );
+ propsIdColl = pfeatureclass3->GetIdentityProperties();
+ propsIdColl->Add( pProp );
pProp = FdoDataPropertyDefinition::Create( L"FeatId", L"FeatId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass4->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pfeatureclass4->GetIdentityProperties())->Add( pProp );
+ propsColl = pfeatureclass4->GetProperties();
+ propsColl->Add( pProp );
+ propsIdColl = pfeatureclass4->GetIdentityProperties();
+ propsIdColl->Add( pProp );
- pTestSchema->GetClasses()->Add( pfeatureclass1 );
- pTestSchema->GetClasses()->Add( pfeatureclass2 );
- pTestSchema->GetClasses()->Add( pfeatureclass3 );
- pTestSchema->GetClasses()->Add( pfeatureclass4 );
+ FdoPtr<FdoClassCollection> clsColl = pTestSchema->GetClasses();
+ clsColl->Add( pfeatureclass1 );
+ clsColl->Add( pfeatureclass2 );
+ clsColl->Add( pfeatureclass3 );
+ clsColl->Add( pfeatureclass4 );
- FdoPtr<FdoFeatureClass>pclass = FdoFeatureClass::Create(L"AssoClass", L"Associated FeatureClass Desc");
+ FdoPtr<FdoFeatureClass> pclass = FdoFeatureClass::Create(L"AssoClass", L"Associated FeatureClass Desc");
pProp = FdoDataPropertyDefinition::Create( L"FeatId", L"FeatId Prop" );
pProp->SetDataType( FdoDataType_Int64 );
pProp->SetNullable(false);
pProp->SetIsAutoGenerated(true);
- FdoPtr<FdoPropertyDefinitionCollection>(pclass->GetProperties())->Add( pProp );
- FdoPtr<FdoDataPropertyDefinitionCollection>(pclass->GetIdentityProperties())->Add( pProp );
- pTestSchema->GetClasses()->Add( pclass );
+ propsColl = pclass->GetProperties();
+ propsColl->Add( pProp );
+ propsIdColl = pclass->GetIdentityProperties();
+ propsIdColl->Add( pProp );
+ clsColl->Add( pclass );
FdoPtr<FdoAssociationPropertyDefinition> passprop = FdoAssociationPropertyDefinition::Create(L"AssocProp1", L"Association Prop Desc");
passprop->SetAssociatedClass(pclass);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass1->GetProperties())->Add( passprop );
+ propsColl = pfeatureclass1->GetProperties();
+ propsColl->Add( passprop );
passprop = FdoAssociationPropertyDefinition::Create(L"AssocProp1", L"Association Prop Desc");
passprop->SetAssociatedClass(pclass);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass2->GetProperties())->Add( passprop );
+ propsColl = pfeatureclass2->GetProperties();
+ propsColl->Add( passprop );
passprop = FdoAssociationPropertyDefinition::Create(L"AssocProp1", L"Association Prop Desc");
passprop->SetAssociatedClass(pclass);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass3->GetProperties())->Add( passprop );
+ propsColl = pfeatureclass3->GetProperties();
+ propsColl->Add( passprop );
passprop = FdoAssociationPropertyDefinition::Create(L"AssocProp1", L"Association Prop Desc");
passprop->SetAssociatedClass(pclass);
- FdoPtr<FdoPropertyDefinitionCollection>(pfeatureclass4->GetProperties())->Add( passprop );
+ propsColl = pfeatureclass4->GetProperties();
+ propsColl->Add( passprop );
FdoPtr<FdoIApplySchema>pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.h 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationSchemaTest.h 2007-03-21 20:54:55 UTC (rev 2703)
@@ -49,18 +49,18 @@
void setUp ();
void tearDown ();
- void TestCreate_NoIdent () { TestCreate( false, false ); }
+ virtual void TestCreate_NoIdent () { TestCreate( false, false ); }
- void TestCreate_NoIdentAssocFeatClass () { TestCreate( false, false,false,false,true,true ); }
- void TestCreate_WithIdent (){ TestCreate( true, false ); }
- void TestCreate_WithIdentNoFeatClass (){ TestCreate( true, false, false, false, true, false, false ); }
- void TestCreate_WithIdentNoFeatClassSubClass (){ TestCreate( true, false, false, false, true, false, false, true ); }
- void TestCreate_NoIdentObj () { TestCreate( false, true ); }
- void TestCreate_WithIdentObj (){ TestCreate( true, true ); }
- void TestCreate_NoIdentObjNested () { TestCreate( false, true, true ); }
- void TestCreate_Rollback () { TestCreate( false, false, false, true, false ); }
- void TestLoadWithObj() { TestLoad(true); }
- void TestLoadWithNoObj() { TestLoad(false); }
+ virtual void TestCreate_NoIdentAssocFeatClass () { TestCreate( false, false,false,false,true,true ); }
+ virtual void TestCreate_WithIdent (){ TestCreate( true, false ); }
+ virtual void TestCreate_WithIdentNoFeatClass (){ TestCreate( true, false, false, false, true, false, false ); }
+ virtual void TestCreate_WithIdentNoFeatClassSubClass (){ TestCreate( true, false, false, false, true, false, false, true ); }
+ virtual void TestCreate_NoIdentObj () { TestCreate( false, true ); }
+ virtual void TestCreate_WithIdentObj (){ TestCreate( true, true ); }
+ virtual void TestCreate_NoIdentObjNested () { TestCreate( false, true, true ); }
+ virtual void TestCreate_Rollback () { TestCreate( false, false, false, true, false ); }
+ virtual void TestLoadWithObj() { TestLoad(true); }
+ virtual void TestLoadWithNoObj() { TestLoad(false); }
void TestCreate (bool useIdent, bool useObjProp, bool useNetstedObj = false, bool useTransaction = false,
bool commitTransaction=true, bool associatedIsFeat=false, bool ownerIsFeat=true, bool addToSubclass=false );
@@ -68,10 +68,10 @@
void TestLoad ( bool withOjb );
void TestDelete ( bool rollbak );
- void TestDelete_rollbak ( ) { TestDelete( true ); }
- void TestDelete_commit ( ) { TestDelete( false ); }
- void TestCreateMultiple();
- void TestLoadMultiple();
+ virtual void TestDelete_rollbak ( ) { TestDelete( true ); }
+ virtual void TestDelete_commit ( ) { TestDelete( false ); }
+ virtual void TestCreateMultiple();
+ virtual void TestLoadMultiple();
protected:
virtual void set_provider() {};
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationUpdateTest.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationUpdateTest.h 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoAssociationUpdateTest.h 2007-03-21 20:54:55 UTC (rev 2703)
@@ -55,15 +55,15 @@
virtual ~FdoAssociationUpdateTest(void);
void setUp () { mSchemaUtil = GetSchemaUtil(); mSchemaUtil->setUp(); }
void tearDown () { mSchemaUtil->tearDown (); }
- void update_NoIdent();
- void update_NoIdentAssocFeatClass ();
- void update_WithIdent();
- void update_WithIdentNoFeatClass();
- void update_WithIdentParent();
- void update_WithIdentError();
- void update_NoIdentObj();
- void update_WithIdentObj();
- void update_NoIdentObjNested();
+ virtual void update_NoIdent();
+ virtual void update_NoIdentAssocFeatClass ();
+ virtual void update_WithIdent();
+ virtual void update_WithIdentNoFeatClass();
+ virtual void update_WithIdentParent();
+ virtual void update_WithIdentError();
+ virtual void update_NoIdentObj();
+ virtual void update_WithIdentObj();
+ virtual void update_NoIdentObjNested();
private:
void masterTestNoObj( AssociationUpdateType type, const wchar_t* name1, const wchar_t* name2, int id, bool assocIsFeat=false, bool ownerIsFeat=true );
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoInsertTest.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -847,66 +847,58 @@
void FdoInsertTest::insertDate (FdoIConnection *connection, FdoDateTime dateTime, FdoString*colorIndex)
{
+ double coordsBuffer[400];
+ FdoPtr<FdoPropertyValue> propertyValue;
+ bool supportsZ = (FdoPtr<FdoIGeometryCapabilities>(connection->GetGeometryCapabilities())->GetDimensionalities() & FdoDimensionality_Z);
- try
- {
- double coordsBuffer[400];
- FdoPtr<FdoPropertyValue> propertyValue;
- bool supportsZ = (FdoPtr<FdoIGeometryCapabilities>(connection->GetGeometryCapabilities())->GetDimensionalities() & FdoDimensionality_Z);
+ FdoPtr<FdoITransaction> featureTransaction = connection->BeginTransaction();
+ FdoPtr<FdoIInsert> insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
+ insertCommand->SetFeatureClassName(L"Acad:AcDb3dPolyline");
+ FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
- FdoPtr<FdoITransaction> featureTransaction = connection->BeginTransaction();
- FdoPtr<FdoIInsert> insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
- insertCommand->SetFeatureClassName(L"Acad:AcDb3dPolyline");
- FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
+ FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
+ FdoPtr<FdoILineString> line1;
+ if ( supportsZ )
+ {
+ coordsBuffer[0] = 1.1;
+ coordsBuffer[1] = 2.2;
+ coordsBuffer[2] = 0.0;
+ coordsBuffer[3] = 1.1;
+ coordsBuffer[4] = 3.3;
+ coordsBuffer[5] = 0.0;
+ line1 = gf->CreateLineString(FdoDimensionality_XY|FdoDimensionality_Z, 2*3, coordsBuffer);
+ }
+ else
+ {
+ coordsBuffer[0] = 1.1;
+ coordsBuffer[1] = 2.2;
+ coordsBuffer[2] = 1.1;
+ coordsBuffer[3] = 3.3;
+ line1 = gf->CreateLineString(FdoDimensionality_XY, 2*2, coordsBuffer);
+ }
+ propertyValue = AddNewProperty( propertyValues, L"Geometry");
+ FdoPtr<FdoByteArray> byteArray = gf->GetFgf(line1);
+ FdoPtr<FdoGeometryValue> geometryValue = FdoGeometryValue::Create(byteArray);
+ propertyValue->SetValue(geometryValue);
- FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
- FdoPtr<FdoILineString> line1;
- if ( supportsZ )
- {
- coordsBuffer[0] = 1.1;
- coordsBuffer[1] = 2.2;
- coordsBuffer[2] = 0.0;
- coordsBuffer[3] = 1.1;
- coordsBuffer[4] = 3.3;
- coordsBuffer[5] = 0.0;
- line1 = gf->CreateLineString(FdoDimensionality_XY|FdoDimensionality_Z, 2*3, coordsBuffer);
- }
- else
- {
- coordsBuffer[0] = 1.1;
- coordsBuffer[1] = 2.2;
- coordsBuffer[2] = 1.1;
- coordsBuffer[3] = 3.3;
- line1 = gf->CreateLineString(FdoDimensionality_XY, 2*2, coordsBuffer);
- }
- propertyValue = AddNewProperty( propertyValues, L"Geometry");
- FdoPtr<FdoByteArray> byteArray = gf->GetFgf(line1);
- FdoPtr<FdoGeometryValue> geometryValue = FdoGeometryValue::Create(byteArray);
- propertyValue->SetValue(geometryValue);
+ FdoPtr<FdoDataValue> dataValue;
+ dataValue = FdoDataValue::Create(colorIndex);
+ propertyValue = AddNewProperty( propertyValues, L"color");
+ propertyValue->SetValue(dataValue);
- FdoPtr<FdoDataValue> dataValue;
- dataValue = FdoDataValue::Create(colorIndex);
- propertyValue = AddNewProperty( propertyValues, L"color");
- propertyValue->SetValue(dataValue);
+ dataValue = FdoDataValue::Create(dateTime);
+ propertyValue = AddNewProperty( propertyValues, L"datetime");
+ propertyValue->SetValue(dataValue);
- dataValue = FdoDataValue::Create(dateTime);
- propertyValue = AddNewProperty( propertyValues, L"datetime");
- propertyValue->SetValue(dataValue);
+ FdoPtr<FdoIFeatureReader> reader = insertCommand->Execute();
- FdoPtr<FdoIFeatureReader> reader = insertCommand->Execute();
+ int numberInsertedObjects = 0;
- int numberInsertedObjects = 0;
+ while (reader->ReadNext())
+ numberInsertedObjects++;
+ wprintf(L" Number of rows entered: %d \n", numberInsertedObjects);
- while (reader->ReadNext())
- numberInsertedObjects++;
- wprintf(L" Number of rows entered: %d \n", numberInsertedObjects);
-
- featureTransaction->Commit();
- }
- catch ( ... )
- {
- throw;
- }
+ featureTransaction->Commit();
}
void FdoInsertTest::insertDateVerification (FdoIConnection *connection, int numOfSuccess)
@@ -1165,7 +1157,7 @@
FdoPtr<FdoIInsert>insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
insertCommand->SetFeatureClassName(L"Acad:AcDb3dPolyline");
//FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
- insertCommand->Execute();
+ FdoPtr<FdoIFeatureReader> reader = insertCommand->Execute();
}
catch (FdoCommandException *ex)
{
@@ -1548,63 +1540,65 @@
{
return (FdoDouble) 2.225073858507202e-308;
}
+
void FdoInsertTest::insertAutoGen()
{
- FdoIConnection* connection = UnitTestUtil::GetConnection(mSuffix, true);
- try
- {
- FdoPtr<FdoIDescribeSchema> pDescCmd = (FdoIDescribeSchema*) connection->CreateCommand(FdoCommandType_DescribeSchema);
- FdoFeatureSchemasP pSchemas = pDescCmd->Execute();
- if (pSchemas)
- {
- FdoFeatureSchemaP pSchema = pSchemas->FindItem( L"TestEmpty" );
- if (!pSchema)
- {
- FdoIApplySchema* pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
- //FdoPtr<FdoFeatureSchemaCollection> pSchemas = FdoFeatureSchemaCollection::Create(NULL);
+ FdoPtr<FdoIConnection> connection = UnitTestUtil::GetConnection(mSuffix, true);
+ try
+ {
+ FdoPtr<FdoIDescribeSchema> pDescCmd = (FdoIDescribeSchema*) connection->CreateCommand(FdoCommandType_DescribeSchema);
+ FdoFeatureSchemasP pSchemas = pDescCmd->Execute();
+ if (pSchemas)
+ {
+ FdoFeatureSchemaP pSchema = pSchemas->FindItem( L"TestEmpty" );
+ if (!pSchema)
+ {
+ FdoPtr<FdoIApplySchema> pCmd = (FdoIApplySchema*) connection->CreateCommand(FdoCommandType_ApplySchema);
+ //FdoPtr<FdoFeatureSchemaCollection> pSchemas = FdoFeatureSchemaCollection::Create(NULL);
- FdoFeatureSchema* pNewSchema = FdoFeatureSchema::Create( L"TestEmpty", L"Test schema" );
- //pSchemas->Add( pSchema );
- FdoClass* pNewClass = FdoClass::Create( L"Empty", L"Test class" );
- pNewClass->SetIsAbstract(false);
- FdoDataPropertyDefinition* pProp = FdoDataPropertyDefinition::Create( L"AttrId", L"id" );
- pProp->SetDataType( FdoDataType_Int64 );
- pProp->SetNullable(false);
- pProp->SetIsAutoGenerated(true);
- pNewClass->GetProperties()->Add( pProp );
- pNewClass->GetIdentityProperties()->Add( pProp );
+ FdoPtr<FdoFeatureSchema> pNewSchema = FdoFeatureSchema::Create( L"TestEmpty", L"Test schema" );
+ //pSchemas->Add( pSchema );
+ FdoPtr<FdoClass> pNewClass = FdoClass::Create( L"Empty", L"Test class" );
+ pNewClass->SetIsAbstract(false);
+ FdoPtr<FdoDataPropertyDefinition> pProp = FdoDataPropertyDefinition::Create( L"AttrId", L"id" );
+ pProp->SetDataType( FdoDataType_Int64 );
+ pProp->SetNullable(false);
+ pProp->SetIsAutoGenerated(true);
+ FdoPtr<FdoPropertyDefinitionCollection> pProps = pNewClass->GetProperties();
+ pProps->Add( pProp );
+ FdoPtr<FdoDataPropertyDefinitionCollection> pIdProps = pNewClass->GetIdentityProperties();
+ pIdProps->Add( pProp );
- pProp = FdoDataPropertyDefinition::Create( L"AttrName", L"Name" );
- pProp->SetDataType( FdoDataType_String );
- pProp->SetLength(64);
- pProp->SetNullable(true);
- pNewClass->GetProperties()->Add( pProp );
+ pProp = FdoDataPropertyDefinition::Create( L"AttrName", L"Name" );
+ pProp->SetDataType( FdoDataType_String );
+ pProp->SetLength(64);
+ pProp->SetNullable(true);
+ pProps->Add( pProp );
- FDO_SAFE_RELEASE(pProp);
+ FdoPtr<FdoClassCollection> pClassColl = pNewSchema->GetClasses();
+ pClassColl->Add( pNewClass );
+ pCmd->SetFeatureSchema( pNewSchema );
+ pCmd->Execute();
+ }
+ }
- pNewSchema->GetClasses()->Add( pNewClass );
- pCmd->SetFeatureSchema( pNewSchema );
- pCmd->Execute();
- }
- }
-
- FdoIInsert *insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
- insertCommand->SetFeatureClassName(L"TestEmpty:Empty");
- FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
- FdoIFeatureReader *myReader = insertCommand->Execute();
- CPPUNIT_ASSERT(myReader != NULL);
-
- while (myReader->ReadNext())
- {
- CPPUNIT_ASSERT(!myReader->IsNull(L"AttrId"));
- }
- myReader->Release();
- connection->Close();
- }
- catch (...)
+ FdoPtr<FdoIInsert> insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
+ insertCommand->SetFeatureClassName(L"TestEmpty:Empty");
+ FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
+ FdoPtr<FdoIFeatureReader> myReader = insertCommand->Execute();
+ CPPUNIT_ASSERT(myReader != NULL);
+
+ while (myReader->ReadNext())
+ {
+ CPPUNIT_ASSERT(!myReader->IsNull(L"AttrId"));
+ }
+ myReader->Close();
+ connection->Close();
+ }
+ catch (FdoException* e)
{
connection->Close ();
- throw;
+ TestCommonFail(e);
}
}
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/FdoUpdateTest.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -1860,7 +1860,6 @@
);
// Select and verify all data (post-update state).
-
SelectNoMetaAll( connection, phMgr, table_id_geom, m_hasGeom, m_hasAssoc );
SelectNoMetaAll( connection, phMgr, L"VIEW_ID_GEOM", m_hasGeom, false );
SelectNoMetaAll( connection, phMgr, L"TABLE_NOID_GEOM", m_hasGeom, false );
@@ -1871,30 +1870,34 @@
SelectNoMetaFilter( connection, phMgr, L"TABLE_NOID_GEOM", m_hasGeom, false );
SelectNoMetaFilter( connection, phMgr, table_noid_nogeom, false, false );
- SelectNoMetaProps( connection, phMgr, table_id_geom, m_hasGeom );
- SelectNoMetaProps( connection, phMgr, L"VIEW_ID_GEOM", m_hasGeom );
- SelectNoMetaProps( connection, phMgr, L"TABLE_NOID_GEOM", m_hasGeom );
- SelectNoMetaProps( connection, phMgr, table_noid_nogeom, false );
-
#ifndef RDBI_DEF_SSQL
SelectNoMetaSpatial( connection, phMgr, table_id_geom, m_hasAssoc );
SelectNoMetaSpatial( connection, phMgr, L"VIEW_ID_GEOM", false );
SelectNoMetaSpatial( connection, phMgr, L"TABLE_NOID_GEOM", false );
#endif
+ SelectNoMetaProps( connection, phMgr, table_id_geom, m_hasGeom );
+ SelectNoMetaProps( connection, phMgr, L"VIEW_ID_GEOM", m_hasGeom );
+ SelectNoMetaProps( connection, phMgr, L"TABLE_NOID_GEOM", m_hasGeom );
+ SelectNoMetaProps( connection, phMgr, table_noid_nogeom, false );
+
connection->Close ();
phMgr = NULL;
mgr = NULL;
conn->disconnect();
delete conn;
+ conn = NULL;
}
catch (FdoException *ex)
{
try {
if( connection )
+ connection->Close ();
+ if (conn != NULL)
{
- connection->Close ();
+ conn->disconnect();
+ delete conn;
}
}
catch ( ... )
@@ -1906,8 +1909,11 @@
{
try {
if( connection )
+ connection->Close ();
+ if (conn != NULL)
{
- connection->Close ();
+ conn->disconnect();
+ delete conn;
}
}
catch ( ... )
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoInsertTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoInsertTest.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoInsertTest.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -147,7 +147,7 @@
{
wprintf(L" Unexpected Exception: %ls\n", ex->GetExceptionMessage());
connection->Close();
- throw ex;
+ UnitTestUtil::FailOnException(ex);
}
wchar_t expectedErrMsg[] = L"Incomplete date/time setting. ";
@@ -160,17 +160,17 @@
{
wprintf(L" Unexpected Exception: %ls\n", ex->GetExceptionMessage());
connection->Close();
- throw ex;
+ UnitTestUtil::FailOnException(ex);
}
else
wprintf(L" Expected Exception: %ls\n", ex->GetExceptionMessage());
+ ex->Release();
}
catch ( ... )
{
- wprintf(L" Unexpected Exception in insertDate()\n");
connection->Close();
- throw;
+ UnitTestUtil::FailOnException(FdoException::Create(L" Unexpected Exception in insertDate()\n"));
}
}
@@ -238,10 +238,11 @@
mgr = NULL;
conn->disconnect();
delete conn;
+ conn = NULL;
FdoPtr<FdoIConnection> connection = UnitTestUtil::GetConnection(UNSIGNED_SUFFIX, false);
FdoPtr<FdoITransaction> featureTransaction = connection->BeginTransaction();
- FdoIInsert *insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
+ FdoPtr<FdoIInsert> insertCommand = (FdoIInsert *) connection->CreateCommand(FdoCommandType_Insert);
insertCommand->SetFeatureClassName(tableName);
FdoPtr<FdoPropertyValueCollection> propertyValues = insertCommand->GetPropertyValues();
@@ -267,10 +268,9 @@
reader = insertCommand->Execute();
featureTransaction->Commit();
- insertCommand->Release();
// check
- FdoISelect* selectCmd = (FdoISelect *) connection->CreateCommand(FdoCommandType_Select);
+ FdoPtr<FdoISelect> selectCmd = (FdoISelect *) connection->CreateCommand(FdoCommandType_Select);
selectCmd->SetFeatureClassName(tableName);
FdoPtr<FdoIFeatureReader> featureReader = selectCmd->Execute();
@@ -289,15 +289,24 @@
break;
}
}
-
CPPUNIT_ASSERT( rowCount == 2 );
}
catch (FdoCommandException *ex)
{
+ if (conn)
+ {
+ conn->disconnect();
+ delete conn;
+ }
UnitTestUtil::FailOnException(ex);
}
catch (FdoException *ex)
{
+ if (conn)
+ {
+ conn->disconnect();
+ delete conn;
+ }
UnitTestUtil::FailOnException(ex);
}
}
@@ -336,7 +345,8 @@
owner->Commit();
owner->SetCurrent();
- GdbiConnection* gdbiConnection = phMgr->SmartCast<FdoSmPhGrdMgr>()->GetGdbiConnection();
+ FdoSmPhGrdMgrP grdMgr = phMgr->SmartCast<FdoSmPhGrdMgr>();
+ GdbiConnection* gdbiConnection = grdMgr->GetGdbiConnection();
// Create tables for various combinations of character set and types of characters
// that will be stored in the table.
@@ -351,6 +361,12 @@
charSetCreateTable( gdbiConnection, L"cp932", L"ascii7" );
charSetCreateTable( gdbiConnection, L"cp932", L"japan" );
+ phMgr = NULL;
+ mgr = NULL;
+ conn->disconnect();
+ delete conn;
+ conn = NULL;
+
// A couple of combinations are not tried:
// - latin11 character set, Japanese characters
// = cp932 character set, 8 bit characters
@@ -372,10 +388,20 @@
}
catch (FdoCommandException *ex)
{
+ if (conn)
+ {
+ conn->disconnect();
+ delete conn;
+ }
UnitTestUtil::FailOnException(ex);
}
catch (FdoException *ex)
{
+ if (conn)
+ {
+ conn->disconnect();
+ delete conn;
+ }
UnitTestUtil::FailOnException(ex);
}
}
@@ -419,7 +445,7 @@
dataValue = FdoDataValue::Create(charVal);
propertyValue->SetValue(dataValue);
- insertCommand->Execute();
+ FdoPtr<FdoIFeatureReader>rdr = insertCommand->Execute();
FdoPtr<FdoISelect>selCmd = (FdoISelect*)connection->CreateCommand( FdoCommandType_Select );
selCmd->SetFeatureClassName(className);
Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -55,6 +55,7 @@
UnitTestUtil::Sql2Db( (const wchar_t**) mForeignPolygonTest, connection.p );
connection->Close();
}
+ catch(FdoException* e){e->Release();}
catch(...){}
userConnectString = UnitTestUtil::GetConnectionString(Connection_WithDatastore, L"_foreign_sch");
Modified: trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp
===================================================================
--- trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp 2007-03-21 20:38:20 UTC (rev 2702)
+++ trunk/Utilities/SchemaMgr/Src/Sm/Ph/Owner.cpp 2007-03-21 20:54:55 UTC (rev 2703)
@@ -960,6 +960,7 @@
scName = FdoStringP::Format(L"%ls_%ld", scReader->GetName(), currSC);
// Generate physical spatial context from current SpatialContextGeom
+ FdoPtr<FdoByteArray> scExtent = scReader->GetExtent();
FdoSmPhSpatialContextP sc = new FdoSmPhSpatialContext(
GetManager(),
scReader->GetSrid(),
@@ -968,7 +969,7 @@
scReader->GetCoordinateSystem(),
scReader->GetCoordinateSystemWkt(),
scReader->GetExtentType(),
- scReader->GetExtent(),
+ scExtent,
scReader->GetXYTolerance(),
scReader->GetZTolerance()
);
More information about the fdo-commits
mailing list