[fdo-commits] r777 - in
branches/3.2.x/Providers/GenericRdbms/Src/Fdo: FeatureCommands Pvc
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Mar 5 12:38:02 EST 2007
Author: brentrobinson
Date: 2007-03-05 12:38:01 -0500 (Mon, 05 Mar 2007)
New Revision: 777
Modified:
branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsInsertCommand.cpp
branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsUpdateCommand.cpp
branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcInsertHandler.cpp
branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcUpdateHandler.cpp
Log:
Handle missing system properties for externally created tables
Modified: branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsInsertCommand.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsInsertCommand.cpp 2007-03-03 19:03:07 UTC (rev 776)
+++ branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsInsertCommand.cpp 2007-03-05 17:38:01 UTC (rev 777)
@@ -131,6 +131,9 @@
{
// check Feat Id property
const FdoSmLpDataPropertyDefinition *lpFeatIdProp = classDefinition->RefFeatIdProperty();
+ if ( (lpFeatIdProp != NULL) && (lpFeatIdProp->RefColumn() == NULL) )
+ lpFeatIdProp = NULL;
+
if( lpFeatIdProp != NULL ) {
const wchar_t *featId = lpFeatIdProp->GetName();
@@ -162,29 +165,34 @@
addedIndentProperties = true;
- FdoPtr<FdoPropertyValue>classId = FdoPropertyValue::Create();
- FdoPtr<FdoDataValue>clidValue = FdoDataValue::Create((FdoInt64) feat_info.classid );
- classId->SetValue( clidValue );
- classId->SetName( L"ClassId" );
- mPropertyValues->Add( classId );
+ const FdoSmLpDataPropertyDefinition *lpSystemProp = FdoSmLpDataPropertyDefinition::Cast(classDefinition->RefProperties()->RefItem(L"ClassId"));
+ if ( lpSystemProp && lpSystemProp->RefColumn() ) {
+ FdoPtr<FdoPropertyValue>classId = FdoPropertyValue::Create();
+ FdoPtr<FdoDataValue>clidValue = FdoDataValue::Create((FdoInt64) feat_info.classid );
+ classId->SetValue( clidValue );
+ classId->SetName( lpSystemProp->GetName() );
+ mPropertyValues->Add( classId );
+ }
- FdoPtr<FdoPropertyValue>revNum = FdoPropertyValue::Create();
- FdoPtr<FdoDataValue>revValue = FdoDataValue::Create((FdoInt64) 0 );
- revNum->SetValue( revValue );
- revNum->SetName( L"RevisionNumber" );
- mPropertyValues->Add( revNum );
-
FdoPtr<FdoPropertyValue>featIdProp = FdoPropertyValue::Create();
FdoPtr<FdoIdentifier>featIdIdentifier = FeatIdProp->GetName();
featIdProp->SetName( featIdIdentifier );
featInfoCol->Add(featIdProp);
- FdoPtr<FdoPropertyValue>chgSeqProp = FdoPropertyValue::Create();
- FdoPtr<FdoDataValue>chgSeqValue = FdoDataValue::Create((FdoInt64) feat_info.changeseq );
- chgSeqProp->SetValue( chgSeqValue );
- chgSeqProp->SetName( L"RevisionNumber" );
- featInfoCol->Add(chgSeqProp);
+ lpSystemProp = FdoSmLpDataPropertyDefinition::Cast(classDefinition->RefProperties()->RefItem(L"RevisionNumber"));
+ if ( lpSystemProp && lpSystemProp->RefColumn() ) {
+ FdoPtr<FdoPropertyValue>revNum = FdoPropertyValue::Create();
+ FdoPtr<FdoDataValue>revValue = FdoDataValue::Create((FdoInt64) 0 );
+ revNum->SetValue( revValue );
+ revNum->SetName( lpSystemProp->GetName() );
+ mPropertyValues->Add( revNum );
+ FdoPtr<FdoPropertyValue>chgSeqProp = FdoPropertyValue::Create();
+ FdoPtr<FdoDataValue>chgSeqValue = FdoDataValue::Create((FdoInt64) feat_info.changeseq );
+ chgSeqProp->SetValue( chgSeqValue );
+ chgSeqProp->SetName( lpSystemProp->GetName() );
+ featInfoCol->Add(chgSeqProp);
+ }
//
// Set the featID value in the Property value collections
if( FeatIdProp.p != NULL && !isFeatIdAutoincremented)
Modified: branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsUpdateCommand.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsUpdateCommand.cpp 2007-03-03 19:03:07 UTC (rev 776)
+++ branches/3.2.x/Providers/GenericRdbms/Src/Fdo/FeatureCommands/FdoRdbmsUpdateCommand.cpp 2007-03-05 17:38:01 UTC (rev 777)
@@ -201,13 +201,16 @@
if ( isFeatClass ) {
featIdProp = classDefinition->RefFeatIdProperty();
if( featIdProp != NULL ) {
- prmPrtName = featIdProp->GetName();
- if ( (prmPrtName == NULL) || (wcslen(prmPrtName) == 0) )
- throw FdoCommandException::Create( NlsMsgGet( FDORDBMS_15, "Feature ID does not exist") );
+ const FdoSmPhColumn* featIdCol = featIdProp->RefColumn();
- const wchar_t *colName = mConnection->GetSchemaUtil()->Property2ColName( className->GetText(), prmPrtName );
- prmColName = (wchar_t*)alloca ((wcslen(colName) + 1)*sizeof( wchar_t ) );
- wcscpy(prmColName, colName);
+ if ( featIdCol != NULL ) {
+ const wchar_t *colName = featIdCol->GetName();
+ prmColName = (wchar_t*)alloca ((wcslen(colName) + 1)*sizeof( wchar_t ) );
+ wcscpy(prmColName, colName);
+ }
+ else {
+ featIdProp = NULL;
+ }
}
}
Modified: branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcInsertHandler.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcInsertHandler.cpp 2007-03-03 19:03:07 UTC (rev 776)
+++ branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcInsertHandler.cpp 2007-03-05 17:38:01 UTC (rev 777)
@@ -1088,10 +1088,20 @@
const FdoSmPhColumn *column = dataProp->RefColumn();
if (NULL == column)
{
- throw FdoRdbmsException::Create(NlsMsgGet1(
- FDORDBMS_485,
- "No column for property '%1$ls'.",
- dataProp->GetName()));
+ if ( dataProp->GetIsSystem() )
+ {
+ // It is possible for externally defined tables to not have
+ // columns for certain system properties. In this case,
+ // skip these properties.
+ continue;
+ }
+ else
+ {
+ throw FdoRdbmsException::Create(NlsMsgGet1(
+ FDORDBMS_485,
+ "No column for property '%1$ls'.",
+ dataProp->GetName()));
+ }
}
const wchar_t *colName = column->GetName();
Modified: branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcUpdateHandler.cpp
===================================================================
--- branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcUpdateHandler.cpp 2007-03-03 19:03:07 UTC (rev 776)
+++ branches/3.2.x/Providers/GenericRdbms/Src/Fdo/Pvc/FdoRdbmsPvcUpdateHandler.cpp 2007-03-05 17:38:01 UTC (rev 777)
@@ -77,7 +77,10 @@
const FdoSmLpDbObject* table = classDefinition->RefDbObject();
FdoStringP tableName = table->RefDbObject()->GetDbQName();
FdoStringP updateString;
- const FdoSmLpPropertyDefinition *pDef = classDefinition->RefProperties()->RefItem(L"RevisionNumber");
+ const FdoSmLpDataPropertyDefinition *pDef = FdoSmLpDataPropertyDefinition::Cast(classDefinition->RefProperties()->RefItem(L"RevisionNumber"));
+ if ( (pDef != NULL) && (pDef->RefColumn() == NULL) )
+ pDef = NULL;
+
if (pDef && revisionNumberUpdate)
updateString = FdoStringP::Format(L"update %ls set revisionnumber = revisionnumber+1, ", (FdoString *) tableName );
else
More information about the fdo-commits
mailing list