1

I have a mobile app written using Apache Cordova. I am using Azure Mobile Apps to store some data.
I created Easy Tables and 1 Easy API. The purpose of the API is to perform delete / update more than 1 record. Below is the implementation of the API.

exports.post = function (request, response){ var mssql = request.service.mssql; var sql = "delete from cust where deptno in ( ? )"; mssql.query(sql, [request.parameters],{ success : function(result){ response.send(statusCodes.OK, result); }, error: function(err) { response.send(statusCodes.BAD_REQUEST, { message: err}); } }); } 

Is there any other way to implement it ? The del() method on table object on takes id to delete and I didn't find any other approach to delete multiple rows in the table.
I am having difficulty to test the implementation as the changes in the API code is taking 2-3 hours on average to get deployed. I change the code through Azure website and when I run it, the old code is hit and not the latest changes.

Is there any limitation based on the plans we choose?

Update
The updated code worked.

var sql = "delete from trollsconfig where id in (" + request.body.id + ")"; mssql.query(sql, [request.parameters],{ success : function(result){ response.send(statusCodes.OK, result); }, error: function(err) { response.send(statusCodes.BAD_REQUEST, { message: err}); } }); 

1 Answer 1

2

Let me cover the last one first. You can always restart your service to use the latest code. The code is probably there but the Easy API change is not noticing it. Once your site "times out" and goes to sleep, the code gets reloaded as normal. Logging onto the Azure Portal, selecting your site and clicking Restart should solve the problem.

As to the first problem - there are a variety of ways to implement deletion, but you've pretty much got a good implementation there. I've not run it to test it, but it seems reasonable. What don't you like about it?

Sign up to request clarification or add additional context in comments.

2 Comments

Not about disliking it. I thought if there was a way to do this using the del() method itself but I am unable to figure it out. Thanks for your suggestion on restarting the service.
BTW, I got it working with a slightly modified code and the changes are getting picked up when I restart the service after the changes are done.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.