[TinyOWS-dev] [tinyows] #15: Insert transaction doesn't return id of features in the response
tinyows
trac at camptocamp.com
Mon Dec 15 20:10:33 UTC 2008
#15: Insert transaction doesn't return id of features in the response
----------------------------+-----------------------------------------------
Reporter: nsavard | Owner: nsavard
Type: defect | Status: assigned
Priority: blocker | Version: SVN
Resolution: | Keywords: insert,response,fid
Stage: Unreviewed | Approval: Proposed
Patch: None | Complexity: Unknown
Compatibility: Unknown | Specification: Unnecessary
----------------------------+-----------------------------------------------
Comment (by nsavard):
This comment is exactly the same as comment:4 except for the formating.
Finally I came with a solution. Comments are welcome.
Modify wfs_insert_xml()
1) Define fid as an array with the layer name as the key
2) Loop through all insert properties to retrieve the handle and the idgen
values (if it exists)
3) Set fid[layername] to -1 in the "insert elements layer by layer" for
loop (existing loop)
4) Loop (existing for loop) through all fields and get values, if this is
an "id" field:
{{{
if id use != 0:
if field = id:
retrieve id field value
if idgen exists and idgen != GenerateNew:
check if id exists in database
if id exists:
if idgen = UseExisting
throw exception
return
else
if fid[layername] = -1:
get last id in the database for this specific layer and put
it in "fid[layername]" variable
id = fid[layername] + 1
fid[layername] = id //keep track of fid
put "id" value in the "sql" statement
else:
retrieve field value and put it in the "sql" statement
}}}
Modify wfs_execute_transaction()
{{{
if command = insert:
Loop through all results
add id to insert_results // wfs_request structure
execute the transaction
}}}
--
Ticket URL: <https://www.tinyows.org/trac/tinyows/ticket/15#comment:5>
tinyows <https://www.tinyows.org/trac/tinyows>
TinyOWS
More information about the TinyOWS-dev
mailing list