on 03-07-2014 12:42 AM
I am trying to write a xsodata service that uses a SQL script to create record into a table. How do I get back the primary key field that was generated in the procedure back to the caller.
For example the entity has two fields, ID integer and Name String(50).
The ID is generated using a sequence inside the procedure that is used to insert the record.
I want the caller to know about the id that got generated, how do I do that.
Thanks
I just found the following text in the developer guide, so the question is not valid, I guess. However the text that says "the key must be included in the URL" is incorrect, it should be part of the body.
For CREATE requests, for example, to add a new entry to either a table or an SQL view exposed by an OData service, you must specify an explicit key (not a generated key); the key must be included in the URL as part of the CREATE request. For UPDATE and DELETE requests, you do not need to specify the key explicitly (and if you do, it will be ignored); the key is already known, since it is essential to specify which entry in the table or SQL view must be modified with the UPDATE or DELETE request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can accomplish what you describe but only as of SP7 and with the new XSJS exits in the XSODATA framework. SQLScript exits allow you to use a sequence but then you can't pass back the generated key in the response object. You would still see the dummy key which was passed in. XSJS doesn't have this limitation and allows you to use a sequence (or any other data changes) and pass them back in the response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.