[mapguide-users] MGOS 2.0: MgUpdateFeatures broken

andrea tiveron (e-metodi) andrea.tiveron at e-metodi.it
Sat Jan 30 12:01:25 EST 2010


Greg,
did you remember this problem?
that is my code
the update work fine only the first time
thanks for the help
andrea

            Dim realPath As String =
Request.ServerVariables("APPL_PHYSICAL_PATH")
            Dim configPath As String = realPath + "webconfig.ini"
            MapGuideApi.MgInitializeWebTier(configPath)
            Dim userInfo As New MgUserInformation("Markup", "Markup")
            Dim siteConnection As New MgSiteConnection()
            siteConnection.Open(userInfo)
            Dim resourceService As MgResourceService =
siteConnection.CreateService(MgServiceType.ResourceService)
            Dim featureService As MgFeatureService =
siteConnection.CreateService(MgServiceType.FeatureService)
            Dim dataSource As String = "Library://e-facility/SUAA/" +
namePlan + "/Markup/Data/" + nameLayer + ".FeatureSource"
            Dim featureSourceId As MgResourceIdentifier = New
MgResourceIdentifier(dataSource)
            Dim featureSourceExists As Boolean =
DoesResourceExist(featureSourceId, resourceService)
            If featureSourceExists = False Then
                Response.Write("<div
style=""text-align:justify""><b>Attenzione!</b><br />Non trovato!</div>" &
vbCrLf)
                Response.Write("<script language=""javascript"">" & vbCrLf)
                Response.Write("parent.functionTestConferma(false);" &
vbCrLf)
                Response.Write("</script>" & vbCrLf)
            End If
            Dim className As String = "ambienti"
            Dim filterText As String = "Key = '" + Trim(CStr(IDSpazio)) +
"'"
            Dim queryOption As MgFeatureQueryOptions = New
MgFeatureQueryOptions()
            queryOption.SetFilter(filterText)
            Dim propColl As MgPropertyCollection = New
MgPropertyCollection()
            Dim str As MgStringProperty = New MgStringProperty("Name",
DesSpazio)
            propColl.Add(str)
            Dim updateFeatures2 As MgUpdateFeatures = New
MgUpdateFeatures(className, propColl, filterText)
            Dim commands2 As MgFeatureCommandCollection = New
MgFeatureCommandCollection()
            commands2.Add(updateFeatures2)
            'Commit the update
            Dim featureReader =
featureService.SelectFeatures(featureSourceId, className, queryOption)
            featureReader.ReadNext()
            featureReader.Close()
            featureReader.Dispose()
            featureService.UpdateFeatures(featureSourceId, commands2, False)
            featureReader = featureService.SelectFeatures(featureSourceId,
className, queryOption)
            featureReader.ReadNext()
            featureReader.Close()
            featureReader.Dispose()


-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of gregboone
Sent: venerdì 4 aprile 2008 16.29
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] MGOS 2.0: MgUpdateFeatures broken



I have another recommendation. You should make a call to
FdoIFeatureReader->Dispose() after the call to Close() so that the garbage
collection can happen immediately and all allocated SQLite resources freed.

Greg


Maksim Sestic wrote:
> 
> Hi Ismael,
> 
> In case you're using managed wrapper, you may consider reading following
> thread on FDO wiki:
> http://www.nabble.com/.net-Wrapper-quirks-to16318694s18162.html
> 
> including related Ticket:
> http://trac.osgeo.org/fdo/ticket/284
> 
> Regards,
> Maksim Sestic
> 
> 
> 
> Ismael Cams wrote:
>> 
>> You are right. It was indeed a FeatureReader problem. I was closing it,
>> but only after having done the update. Somehow it did not give problems
>> in MGOS 1.2.
>> I have moved the close() before the deletion/update of the feature and it
>> is working fine now. 
>> 
>> Thanks for the help.
>> 
>> 
>> zspitzer wrote:
>>> 
>>> if your refering to the thread 'Please try your operation later as the
>>> resource was busy' from Adam
>>> it was indeed a feature reader problem
>>> 
>>> On Fri, Apr 4, 2008 at 5:45 PM, Ismael Cams <mapguide2007 at gmail.com>
>>> wrote:
>>>>
>>>>  The featurereader is closed. The identical code is behaving correct on
>>>> MGOS
>>>>  1.2.
>>>>  There is a parallel thread on the forum at the moment which is
>>>> describing
>>>>  the same problem withe updating and deleting features. Might be a bug
>>>> or
>>>>  changed behaviour ?
>>>>
>>>>
>>>>
>>>>  did you open a feature reader and not close it?
>>>>
>>>>
>>>>  --
>>>>  View this message in context:
>>>>
http://www.nabble.com/MGOS-2.0%3A-MgUpdateFeatures-broken-tp16467463s16610p1
6485938.html
>>>>
>>>>
>>>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>>>
>>>>  _______________________________________________
>>>>  mapguide-users mailing list
>>>>  mapguide-users at lists.osgeo.org
>>>>  http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> Zac Spitzer -
>>> http://zacster.blogspot.com (My Blog)
>>> +61 405 847 168
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/MGOS-2.0%3A-MgUpdateFeatures-broken-tp16467463s16610p1
6491561.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users



More information about the mapguide-users mailing list