Yep,
I can confirm that this method with invalid filter won't throw an
exception but much later on the layerdefinition (with same datasource
path) will do it.
public void ClearDataSource(IServerConnection conn, String
dataSourceId, String featureName, string idField, List<int> laiteidt)
{
foreach (int laiteid in laiteidt)
{
com.IDeleteFeatures deleteCmd =
(com.IDeleteFeatures)conn.CreateCommand((int)OSGeo.MapGuide.MaestroAPI.Commands.CommandType.DeleteFeatures);
deleteCmd.FeatureSourceId = dataSourceId;
deleteCmd.ClassName = featureName;
//deleteCmd.Filter = idField + "=" + laiteid;
deleteCmd.Filter = "ID>=0";
try
{
int nDeleted = deleteCmd.Execute();
}
catch (Exception ex)
{
throw ex;
}
}
}
A good hundred lines after:
mg.resSrvc.SetResourceXmlData(layerDef, layerDefContent);
<2013-12-10T09:01:28> 4220 Administrator
Error: Failed to retrieve message for "MgFeatureServiceException".
An exception occurred in FDO component.
The identifier 'ID' was not recognized. (Cause: , Root Cause:
The identifier 'ID' was not recognized. )
StackTrace:
- MgFeatureServiceHandler.ProcessOperation line 83 file
f:\build\ims2014_knight\build_76.1\ent\os\server\src\services\feature\FeatureServiceHandler.cpp
- MgOpUpdateFeatures.Execute line 143 file
f:\build\ims2014_knight\build_76.1\ent\os\server\src\services\feature\OpUpdateFeatures.cpp
This obviously refers to the ClearDataSource method, not to the
SetResourceXmlData()..
How on earth this can be like that? FDO is OSGeo.SDF. Any idea?
- mika -
P.S: I guess the execute() method will return -1 if something goes
wrong. That could be used for "catching the exception"..?
[email protected] kirjoitti 2013-12-10 07:01:
Maybe I should try that now with an invalid filter and while wrapped
with try and catch, see if the exception is thrown properly. Peculiar
thing is that the exception concerning the non-existing attribute was
thrown much later when calling resource saving..
Yep, the OR-filter would be better although there are only a little
number of ids, often only couple and rows with the same id can be
many
- it is a type id.
- mika -
Jackie Ng kirjoitti 2013-12-10 04:50:
If you delete with an invalid filter, the FDO provider would (and
should)
throw an exception to indicate this.
Also, rather than execute individual deletes for each id, you could
chain
those ids together into a single filter with multiple logical ORs or
if the
provider supports it, use an IN filter
- Jackie
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/local-connection-tp5091886p5093446.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users