Skip to main content
Version: SDK-5.9.6

Update

public BackendReturnObject Update(string tableName, Where where, Param param);

Parameters

ValueTypeDescription
tableNamestringName of table to be updated
whereWhereparam used to find rows to be updated
paramParamInformation to be updated

Description

From the values stored in the table, searches and modifies one row that corresponds to the 'where' conditional statement.

  • The data can be modified regardless of schema definition status.
  • Only one row can be modified.
  • If multiple rows are retrieved by the where query, the last inserted row is modified.
  • Regardless of the public/private status, you can only modify your own data.
  • For numerical data, you can safely input numbers up to 9,007,199,254,740,991(approximately 9 quadrillion).
    When your input data exceeds the limit above, place values in units and tens are rounded down to 0.
    As the number increases and place values expand, small numbers are rounded down, and large numbers are maintained up to 16 - 18 digits, based on the left.
    For long, the data is saved as shown below:
    12345678912345678 -> 12345678912345678(within the limit of 9 quadrillion, the input number is maintained) 123456789123456789 -> 123456789123456780(exceeds the limit of 9 quadrillion, the last digit is rounded down) 1234567891234567891 -> 1234567891234568000 9223372036854775807 -> 9223372036854776000(the maximum value for 'long')
    When saving an integer with double to save a larger piece of data, the number is displayed as shown below:
    12345678912345678912 -> 12345678912345678000(the 'double' larger than the maximum value of 'long') 123456789123456789123.0 -> 123456789123456800000 1234567891234567891234.0 -> 123456789123456800000000 1.23456789123457E+29 -> 123456789123457000000000000000
    In the case of receiving the number from the client(C#), it may be changed to an exponent format.
    12345678912345678000 -> 1.23456789123457E+19

When only some of the columns in the row exist in param, only those columns are modified.

  • Columns not in the param will not be deleted.

When there are columns that do not exist in a row of the param, they will undergo the following process:

  • For a table whose schema is not defined, if a column that does not exist in the row is updated, a new column is added.
  • For a table whose schema is defined, if a column whose schema is not declared is updated, an error occurs.

When an attempt is made to modify without conditions

When the condition is not specified, such as in the case of new Where(), the modification is proceeded for the row most recently added from the rows owned by the user.

Reserved column

When saving, eight fields, including partition, gamer_id, inDate, updatedAt, sender, receiver, reservationDate, and owner_inDate, are used by the server.
When these columns are included in the param, an error occurs.

ValueDescriptionWhether the value is displayed in BACKND Console
partitionValue used by the server to classify a table.X
gamer_idGamer ID of the row owner.O
inDateinDate of the row.(Key value.)O
updatedAtTime the table was last modified.O
senderValue used internally for BACKND function(e.g., mail)X
receiverValue used internally for BACKND function(e.g., mail)X
reservationDateValue used internally for BACKND function(e.g., mail)X
owner_inDateUser inDate of the row owner.O

In the case of old version tables' rows without the owner_inDate, an owner_inDate column is added when the rows are updated by using the corresponding method.

Example

Synchronous

// Modifies the value of atk column to 110
Param param = new Param();
param.Add("atk", 110);

// Searches data whose key column value is keyCode
Where where = new Where();
where.Equal("key", "keyCode");

Backend.GameData.Update("tableName", where, param);

Asynchronous

// Modifies the value of atk column to 110
Param param = new Param();
param.Add("atk", 110);

// Searches data whose key column value is keyCode
Where where = new Where();
where.Equal("key", "keyCode");

Backend.GameData.Update("tableName", where, param, (callback) =>
{
// Post-process
});

SendQueue

// Modifies the value of atk column to 110
Param param = new Param();
param.Add("atk", 110);

// Searches data whose key column value is keyCode
Where where = new Where();
where.Equal("key", "keyCode");

SendQueue.Enqueue(Backend.GameData.Update, "tableName", where, param, (callback) =>
{
// Post-process
});

Return cases

Success cases

When the modification is successful
statusCode : 204
message : Success

Error cases

(Schema) When there is an attempt to modify a column whose schema is not defined
statusCode : 400
errorCode : BadParameterException
message : bad column does not exist., The column does not exist

(Schema) When the data type of the column declared upon defining the schema is different from that of the column to be updated
statusCode : 400
errorCode : BadParameterException
message : bad {column name} dataType, Invalid {column name} dataType

(Schema) When the size of the list selected upon declaring the list column in the schema is different from the size of the list entered in param
statusCode : 400
errorCode : BadParameterException
message : bad list data length, Invalid list data length

(Schema) When the size of the map selected upon declaring the map column in the schema is different from the size of the map entered in param
statusCode : 400
errorCode : BadParameterException
message : bad map data length, Invalid map data length

When the total number of columns to be modified is over 290
statusCode : 400
errorCode : ValidationException
message : Invalid UpdateExpression: Expression size has exceeded the maximum allowed size;

(Schema) When there is an attempt to search for a column whose schema is not defined with the where condition
statusCode : 404
errorCode : NotFoundException
message : gameInfo not found, gameInfo cannot be found

When the tableName does not exist
statusCode : 404
errorCode : NotFoundException
message : table not found, table cannot be found

When the user searches the table to be updated with the where condition, but the table does not exist
statusCode : 404
errorCode : NotFoundException
message : gameInfo not found, gameInfo cannot be found

When the eight fields(partition, gamer_id, inDate, updatedAt, sender, receiver, reservationDate, and owner_inDate) are included in param
statusCode : 405
errorCode : MethodNotAllowedParameterException
message : MethodNotAllowed {param value}, Unavailable {param value}

When there is an attempt to modify an inactive table
statusCode : 412
errorCode : PreconditionFailed
message : inactiveTable prerequisites are not met.

When the size of data to be updated exceeds 400 KB
statusCode : 413
errorCode : ServerErrorException
message : request entity too large