Skip to content

EnsureData

Inserts or updates a row in the table based on the specified column and value as a single criterion. Only the included columns get updated.

1
$Database.EnsureData(schema: string, table: string, column: string, value: any, input: object, initInput: object):DataRow

Parameters

string schema
    The name of the target schema.

string table
    The name of the target table.

string column
    The name of the column to use as criteria.

any value
    The value of the column to use as criteria.

object input
    A JavaScript object or function for the column values to update.

object initInput
    A JavaScript object or function for initializing values for new rows. Optional.

Returns

A DataRow object representing the inserted or updated row.

Remarks

Example

1
2
3
4
5
6
$Database.EnsureData("MySchema", "MyTable", "Id", id, {
    Id : id,
    Name : $Xml.Evaluate('Name')
}, {
    CreateDate : DateTimeOffset.now
});

See Also