Former-commit-id:a02aeb236c
[formerly9f19e3f712
] [formerly06a8b51d6d
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]] Former-commit-id:06a8b51d6d
Former-commit-id:3360eb6c5f
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
/**
|
|
* Updates an entry in a table.
|
|
*
|
|
* Usage:
|
|
* include("TableResponse.js");
|
|
* var query = new TableUpdate("tableName", "rowName");
|
|
* var results = query.execute();
|
|
*/
|
|
|
|
/**
|
|
* Class constructor.
|
|
*
|
|
* @param tableName (String) identifies the table
|
|
* @param rowName (String) identifies the row
|
|
*/
|
|
function TableResponse(database, table, row){
|
|
this.database = database;
|
|
this.tableName = table;
|
|
this.rowName = row
|
|
this.updateResults = null;
|
|
this.update = new TableUpdate(this.database, this.tableName, this.rowName);
|
|
}
|
|
|
|
/**
|
|
* Main action method. Updates the database and returns the XML
|
|
* representation of an acknowledgement.
|
|
*
|
|
* @return (String) XML acknowledgement on success
|
|
* (String) XML null response string on failure
|
|
*/
|
|
function _execute()
|
|
{
|
|
this.updateResults = this.update.execute();
|
|
return this.updateResults;
|
|
}
|
|
|
|
function _makeXmlResponse()
|
|
{
|
|
var response = new Array();
|
|
for(i=0; i < this.updateResults.size(); i++)
|
|
{
|
|
var makeResponse = new MakeResponseXml(this.updateResults.get(i));
|
|
response[i] = makeResponse.execute();
|
|
}
|
|
return response;
|
|
}
|
|
|
|
TableResponse.prototype.execute = _execute;
|
|
TableResponse.prototype.makeXmlResponse = _makeXmlResponse;
|