int CGwsQueryResultDescriptors::Contains (FdoString* propertyName) { FdoPtr<FdoStringCollection> pPropNames = PropertyNames(); for(int i=0;i<pPropNames->GetCount();i++) { FdoString* pComp = pPropNames->GetString(i); if( _wcsicmp( propertyName, pComp ) == 0) return i; } return -1; }
FdoSmPhPostGisSchemasP FdoSmPhPostGisOwner::GetSchemas() { if ( !mSchemas ) { mSchemas = new FdoSmPhPostGisSchemaCollection( this ); FdoSmPhPostGisOwner* pOwner = (FdoSmPhPostGisOwner*) this; FdoPtr<FdoSmPhRdPostGisDbSchemaReader> rdr = new FdoSmPhRdPostGisDbSchemaReader( FDO_SAFE_ADDREF(pOwner) ); while ( rdr->ReadNext() ) { FdoSmPhPostGisSchemaP schema = new FdoSmPhPostGisSchema( rdr->GetString( L"", L"schema_name"), this, rdr ); mSchemas->Add( schema ); } } return mSchemas; }
void SuperMapSelectTest::select_text() { CPPUNIT_ASSERT_MESSAGE("FDO连接未打开!", m_connection != NULL); CPPUNIT_ASSERT_MESSAGE("FDO连接引用次数不为1!", m_connection->GetRefCount() == 1); FdoPtr<FdoISelect> Select; Select = (FdoISelect *)m_connection->CreateCommand(FdoCommandType_Select); if(Select) { Select->SetFeatureClassName(L"文本"); FdoPtr<FdoIFeatureReader> ret; try { ret = Select->Execute(); } catch (FdoException* ex) { FdoException* nex = ex; while (nex) { AfxMessageBox(ex->GetExceptionMessage()); nex = nex->GetCause(); } ex->Release(); } catch(...) { CPPUNIT_FAIL("unresolved exception"); } CPPUNIT_ASSERT_MESSAGE("返回的要素集合为空!", ret != NULL); int count = 0; int SmID; int UserID; FdoString *Text; double TextSize; FdoPtr<FdoByteArray> geometry; try { while (ret->ReadNext ()) { count++; if(!ret->IsNull(L"SmID")) { SmID = ret->GetInt32 (L"SmID"); } if(!ret->IsNull(L"SmUserID")) { UserID = ret->GetInt32 (L"SmUserID"); } if(!ret->IsNull(L"TxtString")) { Text = ret->GetString (L"TxtString"); } if(!ret->IsNull(L"TextSize")) { TextSize = ret->GetDouble (L"TextSize"); } if(!ret->IsNull(L"Geometry")) { geometry = ret->GetGeometry (L"Geometry"); } CPPUNIT_ASSERT_MESSAGE ("几何对象类型不正确", FdoGeometryType_Point == *(int*)geometry->GetData()); } CPPUNIT_ASSERT_MESSAGE ("未查出面数据集中的要素", 0 != count); } catch (FdoException* ex) { FdoException* nex = ex; while (nex) { AfxMessageBox(ex->GetExceptionMessage()); nex = nex->GetCause(); } ex->Release(); } catch(...) { CPPUNIT_FAIL("unresolved exception"); } } }
void SuperMapSelectTest::select_region() { CPPUNIT_ASSERT_MESSAGE("FDO连接未打开!", m_connection != NULL); CPPUNIT_ASSERT_MESSAGE("FDO连接引用次数不为1!", m_connection->GetRefCount() == 1); FdoPtr<FdoISelect> Select; Select = (FdoISelect *)m_connection->CreateCommand(FdoCommandType_Select); Select->SetFeatureClassName(L"面"); FdoPtr<FdoIFeatureReader> ret; try { ret = Select->Execute(); } catch (FdoException* ex) { FdoException* nex = ex; while (nex) { AfxMessageBox(ex->GetExceptionMessage()); nex = nex->GetCause(); } ex->Release(); } catch(...) { CPPUNIT_FAIL("unresolved exception"); } CPPUNIT_ASSERT_MESSAGE("返回的要素集合为空!", ret != NULL); int count = 0; int SmID; int UserID; double SmArea; double SmPerimeter; bool TestBoolen; short TestShort; float TestFloat; FdoString *str; FdoDateTime date; int length; FdoPtr<FdoByteArray> geometry; try { while (ret->ReadNext ()) { count++; if(!ret->IsNull(L"SmID")) { SmID = ret->GetInt32 (L"SmID"); } if(!ret->IsNull(L"SmUserID")) { UserID = ret->GetInt32 (L"SmUserID"); } if(!ret->IsNull(L"SmArea")) { SmArea = ret->GetDouble (L"SmArea"); } if(!ret->IsNull(L"SmPerimeter")) { SmPerimeter = ret->GetDouble (L"SmPerimeter"); } if(!ret->IsNull(L"TestBoolen")) { TestBoolen = ret->GetBoolean (L"TestBoolen"); } if(!ret->IsNull(L"TestShort")) { TestShort = ret->GetInt16(L"TestShort"); } if(!ret->IsNull(L"TestFloat")) { TestFloat = ret->GetSingle(L"TestFloat"); } if(!ret->IsNull(L"TestString")) { str = ret->GetString(L"TestString"); } if(!ret->IsNull(L"TestDate")) { date = ret->GetDateTime(L"TestDate"); } if(!ret->IsNull(L"长度")) { length = ret->GetInt32(L"长度"); } if(!ret->IsNull(L"Geometry")) { geometry = ret->GetGeometry (L"Geometry"); } CPPUNIT_ASSERT_MESSAGE ("几何对象类型不正确", FdoGeometryType_Polygon == *(int*)geometry->GetData()); } CPPUNIT_ASSERT_MESSAGE ("未查出面数据集中的要素", 0 != count); } catch (FdoException* ex) { FdoException* nex = ex; while (nex) { AfxMessageBox(ex->GetExceptionMessage()); nex = nex->GetCause(); } ex->Release(); } catch(...) { CPPUNIT_FAIL("unresolved exception"); } }
void SQLTests::query () { if (CreateSchemaOnly()) return; try { FdoPtr<FdoISQLCommand> sqlCmd = (FdoISQLCommand*)mConnection->CreateCommand (FdoCommandType_SQLCommand); // Clean up previous tests (ignore exceptions, we'll get one if the table doesn't actually exist): try { sqlCmd->SetSQLStatement (L"drop table bar"); sqlCmd->ExecuteNonQuery (); } catch (FdoException *e) { e->Release(); } // Execute various tests: sqlCmd->SetSQLStatement (ArcSDETestConfig::SqlStmtCreateTable()); sqlCmd->ExecuteNonQuery (); sqlCmd->SetSQLStatement (ArcSDETestConfig::SqlStmtInsert1()); sqlCmd->ExecuteNonQuery (); sqlCmd->SetSQLStatement (L"select * from bar"); { FdoPtr<FdoISQLDataReader> reader = sqlCmd->ExecuteReader (); // Test accessing SQLDataReader's metadata BEFORE calling ReadNext(): IterateSQLDataReaderProperties(reader); reader->ReadNext (); CPPUNIT_ASSERT_MESSAGE ("int16 wrong", 42 == reader->GetInt16 (L"ID")); CPPUNIT_ASSERT_MESSAGE ("int32 wrong", 8272772 == reader->GetInt32 (L"COUNT")); float x = (float)reader->GetSingle (L"SCALE"); float diff = x - 1e-2f; if (0 > diff) diff = -diff; CPPUNIT_ASSERT_MESSAGE ("float wrong", 1e-9 > diff); double y = reader->GetDouble (L"LENGTH"); double difference = y - 10280288.29929; if (0 > difference) difference = -difference; CPPUNIT_ASSERT_MESSAGE ("double wrong", 1e-4 > difference); CPPUNIT_ASSERT_MESSAGE ("string wrong", 0 == wcscmp (L"the quick brown fox jumps over a lazy dog", reader->GetString(L"DESCRIPTION"))); FdoPtr<FdoBLOBValue> blobValue = static_cast<FdoBLOBValue*>(reader->GetLOB(L"DATA")); FdoByteArray* data = blobValue->GetData(); FdoByte test[] = { 0x25, 0x2f, 0x82, 0xe3 }; for (int i = 0; i < data->GetCount (); i++) CPPUNIT_ASSERT_MESSAGE ("blob wrong", test[i] == (*data)[i]); data->Release (); FdoDateTime now = reader->GetDateTime (L"MODIFIED"); struct tm systime; #ifdef _WIN32 #pragma warning(disable : 4996) _getsystime (&systime); #pragma warning(default : 4996) #else time_t current; time (¤t); localtime_r (¤t, &systime); #endif CPPUNIT_ASSERT_MESSAGE ("year wrong (NOTE: THIS IS MAY BE CAUSED BY TIME ZONE DIFFERENCE BETWEEN SERVER AND CLIENT MACHINES)", now.year == systime.tm_year + 1900); CPPUNIT_ASSERT_MESSAGE ("month wrong (NOTE: THIS IS MAY BE CAUSED BY TIME ZONE DIFFERENCE BETWEEN SERVER AND CLIENT MACHINES)", now.month == systime.tm_mon + 1); CPPUNIT_ASSERT_MESSAGE ("day wrong (NOTE: THIS IS OFTEN CAUSED BY TIME ZONE DIFFERENCE BETWEEN SERVER AND CLIENT MACHINES)", now.day == systime.tm_mday); //THE FOLLOWING TEST FAILS FREQUENTLY, SINCE THE CLIENT'S TIME AND SERVER'S TIME ARE USUALLY NOT IN SYNC: //CPPUNIT_ASSERT_MESSAGE ("hour wrong", now.hour == systime.tm_hour); } // Test aggregate functions in select clause: sqlCmd->SetSQLStatement (ArcSDETestConfig::SqlStmtInsert2()); sqlCmd->ExecuteNonQuery (); sqlCmd->SetSQLStatement (L"select count(*) from bar"); FdoPtr<FdoISQLDataReader> reader = sqlCmd->ExecuteReader(); CPPUNIT_ASSERT_MESSAGE("Expected 1 row, got 0 rows instead.", reader->ReadNext ()); FdoInt32 colCount = reader->GetColumnCount(); CPPUNIT_ASSERT_MESSAGE ("column count wrong", colCount == 1); FdoString *colName = reader->GetColumnName(0); CPPUNIT_ASSERT_MESSAGE ("column name wrong", 0==FdoCommonOSUtil::wcsicmp(colName, ArcSDETestConfig::SqlCountStarColumnName())); FdoDataType colType = reader->GetColumnType(colName); if (colType==FdoDataType_Int32) { FdoInt32 iRowCount = reader->GetInt32(colName); CPPUNIT_ASSERT_MESSAGE("count(*) value wrong", iRowCount == 2); } else if (colType==FdoDataType_Double) { double dRowCount = reader->GetDouble(colName); CPPUNIT_ASSERT_MESSAGE("count(*) value wrong", dRowCount == 2); } CPPUNIT_ASSERT_MESSAGE("Expected 1 row, got 2 or more rows instead.", !reader->ReadNext ()); // Test functions in where clause: sqlCmd->SetSQLStatement (ArcSDETestConfig::SqlStmtAggrQuery1()); reader = sqlCmd->ExecuteReader(); CPPUNIT_ASSERT_MESSAGE("Expected 1 row, got 0 rows instead.", reader->ReadNext ()); colCount = reader->GetColumnCount(); CPPUNIT_ASSERT_MESSAGE ("column count wrong", colCount == 1); colName = reader->GetColumnName(0); CPPUNIT_ASSERT_MESSAGE ("column name wrong", 0==FdoCommonOSUtil::wcsicmp(colName, ArcSDETestConfig::SqlAggrColumnName())); colType = reader->GetColumnType(colName); CPPUNIT_ASSERT_MESSAGE ("column type wrong", colType==FdoDataType_Double); double dResult = reader->GetDouble(colName); CPPUNIT_ASSERT_MESSAGE("ABS(SUM(length)) value wrong", ArcSDETests::fuzzyEqual(dResult, ArcSDETestConfig::SqlStmtAggrQuery1Result())); CPPUNIT_ASSERT_MESSAGE("Expected 1 row, got 2 or more rows instead.", !reader->ReadNext ()); // Clean up: sqlCmd->SetSQLStatement (L"drop table bar"); sqlCmd->ExecuteNonQuery (); } catch (FdoException *e) { fail(e); } }
/* Test basic update operation. */ void BasicUpdateTests::simple_update () { if (CreateSchemaOnly()) return; try { mConnection = ArcSDETests::GetConnection (); mConnection->SetConnectionString (ArcSDETestConfig::ConnStringMetadcov()); mConnection->Open (); // Clean up previous tests: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassSimple(), ArcSDETestConfig::ClassNameTestClassSimple(), true); // insert a feature FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand (FdoCommandType_Insert); insert->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassSimple()); FdoPtr<FdoPropertyValueCollection> values = insert->GetPropertyValues (); FdoPtr<FdoValueExpression> expression = (FdoValueExpression*)FdoExpression::Parse (Data[0]->mPropertyData[0]); FdoPtr<FdoPropertyValue> value = FdoPropertyValue::Create (Data[0]->mPropertyName, expression); values->Add (value); expression = (FdoValueExpression*)FdoExpression::Parse (L"GeomFromText('POLYGON XY ((5108.8 5104.7, 5109 5104, 5109 5105, 5108.8 5104.7))')"); value = FdoPropertyValue::Create ((FdoString*)GetGeomPropName(), expression); values->Add (value); FdoPtr<FdoIFeatureReader> reader = insert->Execute (); int id; while (reader->ReadNext ()) id = reader->GetInt32 ((FdoString*)GetIdPropName()); reader->Close(); // update it FdoPtr<FdoIUpdate> update = (FdoIUpdate*)mConnection->CreateCommand (FdoCommandType_Update); update->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassSimple()); FdoPtr<FdoPropertyValueCollection> propertyValues = update->GetPropertyValues(); wchar_t filter[1024]; FdoCommonOSUtil::swprintf(filter, ELEMENTS(filter), L"%ls = %d", (FdoString*)GetIdPropName(), id); update->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (filter))); values = update->GetPropertyValues (); value = FdoPropertyValue::Create (); value->SetName (Data[0]->mPropertyName); //FdoPtr<FdoStringValue> _string = static_cast<FdoStringValue*>(value->GetValue ()); //_string->SetNull (); value->SetValue (L"'All mimsy were the borogoves'"); values->Add (value); if (1 != update->Execute ()) CPPUNIT_FAIL ("update execute failed"); // check by doing a select FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select); select->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassSimple()); reader = select->Execute (); while (reader->ReadNext ()) { CPPUNIT_ASSERT_MESSAGE ("incorrect value", 0 == wcscmp (L"All mimsy were the borogoves", reader->GetString (Data[0]->mPropertyName))); // check geometry was not affected FdoPtr<FdoGeometryValue> geometry = (FdoGeometryValue*)FDO_SAFE_ADDREF(expression.p); FdoPtr<FdoByteArray> fetched = reader->GetGeometry ((FdoString*)GetGeomPropName()); FdoString* geometryText = geometry->ToString(); FdoPtr<FdoGeometryValue> fetchedGeom = FdoGeometryValue::Create (fetched); FdoString* fetchedText = fetchedGeom->ToString (); CPPUNIT_ASSERT_MESSAGE ("incorrect geometry value", 0==wcscmp(geometryText, fetchedText)); } reader->Close(); // Clean up after test: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassSimple(), ArcSDETestConfig::ClassNameTestClassSimple(), true); } catch (FdoException* ge) { fail (ge); } }
/* Test insert/update/select on a table that has a UUID column. */ void BasicUpdateTests::update_uuid () { if (CreateSchemaOnly()) return; try { mConnection = ArcSDETests::GetConnection (); mConnection->SetConnectionString (ArcSDETestConfig::ConnStringMetadcov()); mConnection->Open (); // Clean up previous tests: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassUuid(), ArcSDETestConfig::ClassNameTestClassUuid(), true); FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand (FdoCommandType_Insert); insert->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassUuid()); FdoPtr<FdoPropertyValueCollection> values = insert->GetPropertyValues (); FdoPtr<FdoStringValue> expression = FdoStringValue::Create (L"Added"); FdoPtr<FdoPropertyValue> value = FdoPropertyValue::Create (AdjustRdbmsName(L"MYSTRING"), expression); values->Add (value); FdoPtr<FdoIFeatureReader> reader = insert->Execute (); expression->SetString(L"Updated"); reader = insert->Execute (); expression->SetString(L"Deleted"); reader = insert->Execute (); FdoStringP addedUuid1; FdoStringP updatedUuid1; FdoStringP deletedUuid; FdoStringP updatedUuid2 = L"{ABCDEFGH-IJKL-MNOP-QRST-UVWXYZ123456}"; FdoStringP addedUuid3; FdoStringP updatedUuid3; FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select); select->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassUuid()); reader = select->Execute (); while (reader->ReadNext ()) { FdoStringP myString = reader->GetString(AdjustRdbmsName(L"MYSTRING")); if ( myString == L"Added" ) addedUuid1 = reader->GetString(AdjustRdbmsName(L"ID")); else if ( myString == L"Updated" ) updatedUuid1 = reader->GetString(AdjustRdbmsName(L"ID")); else if ( myString == L"Deleted" ) deletedUuid = reader->GetString(AdjustRdbmsName(L"ID")); } reader->Close(); FdoPtr<FdoIUpdate> update = (FdoIUpdate*)mConnection->CreateCommand (FdoCommandType_Update); update->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassUuid()); FdoStringP filter = FdoStringP::Format( L"%ls = '%ls'", (FdoString*) AdjustRdbmsName(L"ID"), (FdoString*) updatedUuid1 ); update->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (filter))); values = update->GetPropertyValues (); value = FdoPropertyValue::Create (); value->SetName (AdjustRdbmsName(L"ID")); expression = FdoStringValue::Create (updatedUuid2); value->SetValue (expression); values->Add (value); bool updateFailed = false; // ID is readonly so update should fail. try { update->Execute (); } catch ( FdoException* ex ) { ex->Release(); updateFailed = true; } CPPUNIT_ASSERT ("update failed"); FdoPtr<FdoIDelete> dlte = (FdoIDelete*)mConnection->CreateCommand (FdoCommandType_Delete); dlte->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassUuid()); filter = FdoStringP::Format( L"%ls = '%ls'", (FdoString*) AdjustRdbmsName(L"ID"), (FdoString*) deletedUuid ); dlte->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (filter))); if (1 != dlte->Execute ()) CPPUNIT_FAIL ("delete execute failed"); // check by doing a select select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select); select->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassUuid()); reader = select->Execute (); int count = 0; while (reader->ReadNext ()) { count++; FdoStringP myString = reader->GetString(AdjustRdbmsName(L"MYSTRING")); if ( myString == L"Added" ) addedUuid3 = reader->GetString(AdjustRdbmsName(L"ID")); else if ( myString == L"Updated" ) updatedUuid3 = reader->GetString(AdjustRdbmsName(L"ID")); } reader->Close(); CPPUNIT_ASSERT( count == 2 ); CPPUNIT_ASSERT( addedUuid3 == addedUuid1 ); CPPUNIT_ASSERT( updatedUuid3 == updatedUuid1 ); CPPUNIT_ASSERT( updatedUuid3 != updatedUuid2 ); mConnection->Close(); } catch (FdoException* ge) { fail (ge); } }
/* Test insert/update/select (but not setting/getting any lock info) on a table that supports locking. */ void BasicUpdateTests::update_on_lock_enabled_table () { if (CreateSchemaOnly()) return; try { mConnection = ArcSDETests::GetConnection (); mConnection->SetConnectionString (ArcSDETestConfig::ConnStringMetadcov()); mConnection->Open (); // Clean up previous tests: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaSample(), ArcSDETestConfig::ClassNameSample(), true); FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand (FdoCommandType_Insert); insert->SetFeatureClassName (ArcSDETestConfig::QClassNameSample()); FdoPtr<FdoPropertyValueCollection> values = insert->GetPropertyValues (); FdoPtr<FdoStringValue> expression = FdoStringValue::Create (L"Zozo"); FdoPtr<FdoPropertyValue> value = FdoPropertyValue::Create (AdjustRdbmsName(L"LockProperty"), expression); values->Add (value); FdoPtr<FdoIFeatureReader> reader = insert->Execute (); FdoInt32 newId = 0; if (reader->ReadNext()) newId = reader->GetInt32(AdjustRdbmsName(L"Id")); FdoPtr<FdoIUpdate> update = (FdoIUpdate*)mConnection->CreateCommand (FdoCommandType_Update); update->SetFeatureClassName (ArcSDETestConfig::QClassNameSample()); wchar_t filter[1024]; FdoCommonOSUtil::swprintf(filter, ELEMENTS(filter), L"%ls = %d", AdjustRdbmsName(L"Id"), newId); update->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (filter))); values = update->GetPropertyValues (); value = FdoPropertyValue::Create (); value->SetName (AdjustRdbmsName(L"LockProperty")); value->SetValue (L"'All mimsy were the borogoves'"); values->Add (value); if (1 != update->Execute ()) CPPUNIT_FAIL ("update execute failed"); // check by doing a select FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select); select->SetFeatureClassName (ArcSDETestConfig::QClassNameSample()); reader = select->Execute (); while (reader->ReadNext ()) { CPPUNIT_ASSERT_MESSAGE ("incorrect value", 0 == wcscmp (L"All mimsy were the borogoves", reader->GetString (AdjustRdbmsName(L"LockProperty")))); } reader->Close(); // Clean up after test: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassSimple(), ArcSDETestConfig::ClassNameSample(), true); mConnection->Close(); } catch (FdoException* ge) { fail (ge); } }
/* Test spatial filter. */ void BasicUpdateTests::spatial_filter () { if (CreateSchemaOnly()) return; try { mConnection = ArcSDETests::GetConnection (); mConnection->SetConnectionString (ArcSDETestConfig::ConnStringMetadcovSingleDb()); mConnection->Open (); // Clean up previous tests: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassComplex(), ArcSDETestConfig::ClassNameTestClassComplex(), true); FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand (FdoCommandType_Insert); insert->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassComplex()); FdoPtr<FdoPropertyValueCollection> values = insert->GetPropertyValues (); FdoPtr<FdoValueExpression> expression = (FdoValueExpression*)FdoExpression::Parse (Data[0]->mPropertyData[0]); FdoPtr<FdoPropertyValue> value = FdoPropertyValue::Create (Data[0]->mPropertyName, expression); values->Add (value); expression = (FdoValueExpression*)FdoExpression::Parse (L"GeomFromText('POLYGON XY ((5010.282 5011.717, 5010.4 5011.7, 5010.4 5011.3, 5010.282 5011.717))')"); value = FdoPropertyValue::Create ((FdoString*)GetGeomPropName(), expression); values->Add (value); FdoPtr<FdoIFeatureReader> reader = insert->Execute (); int id1; while (reader->ReadNext ()) id1 = reader->GetInt32 ((FdoString*)GetIdPropName()); reader->Close(); value = values->GetItem (Data[0]->mPropertyName); expression = (FdoValueExpression*)FdoExpression::Parse (L"'John Smith'"); value->SetValue (expression); value = values->GetItem ((FdoString*)GetGeomPropName()); expression = (FdoValueExpression*)FdoExpression::Parse (L"GeomFromText('POLYGON XY ((5000.919 5000.277, 5000.5 5000.2, 5000.5 5000.7, 5000.919 5000.277))')"); value->SetValue (expression); reader = insert->Execute (); int id2; while (reader->ReadNext ()) id2 = reader->GetInt32 ((FdoString*)GetIdPropName()); reader->Close(); value = values->GetItem (Data[0]->mPropertyName); expression = (FdoValueExpression*)FdoExpression::Parse (L"'Mott the Hoople'"); value->SetValue (expression); value = values->GetItem ((FdoString*)GetGeomPropName()); expression = (FdoValueExpression*)FdoExpression::Parse (L"GeomFromText('POLYGON XY ((5014.262 5015.018, 5014.3 5015.9, 5014.9 5015.9, 5014.262 5015.018))')"); value->SetValue (expression); reader = insert->Execute (); int id3; while (reader->ReadNext ()) id3 = reader->GetInt32 ((FdoString*)GetIdPropName()); reader->Close(); // do a spatial filtered update FdoPtr<FdoIUpdate> update = (FdoIUpdate*)mConnection->CreateCommand (FdoCommandType_Update); update->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassComplex()); update->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (L"SHAPE INTERSECTS GEOMFROMTEXT ('POLYGON XY (( 5012 5012, 5020 5012, 5020 5016, 5012 5016, 5012 5012 ))')"))); values = update->GetPropertyValues (); expression = (FdoValueExpression*)FdoExpression::Parse (L"'Alice in Wonderland'"); value = FdoPropertyValue::Create (Data[0]->mPropertyName, expression); values->Add (value); if (1 != update->Execute ()) CPPUNIT_FAIL ("update execute failed"); // check by doing a select FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select); select->SetFeatureClassName (ArcSDETestConfig::QClassNameTestClassComplex()); reader = select->Execute (); int id; while (reader->ReadNext ()) { id = reader->GetInt32 ((FdoString*)GetIdPropName()); FdoString* item = reader->GetString (Data[0]->mPropertyName); if (id == id3) CPPUNIT_ASSERT_MESSAGE ("value not changed", 0 == wcscmp (item, L"Alice in Wonderland")); else CPPUNIT_ASSERT_MESSAGE ("value mistakenly changed", 0 != wcscmp (item, L"Alice in Wonderland")); } reader->Close(); // Clean up after test: CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassComplex(), ArcSDETestConfig::ClassNameTestClassComplex(), true); } catch (FdoException* ge) { fail (ge); } }