| PHP |
|---|
| public function Update(LJCDbColumns $keyColumns, LJCDbColumns $dataColumns) |
The $keyColumns collection parameter contains the data for the where clause.
The $keyColumns parameter is required and must have collection elements or the Update will not be executed.| PHP |
|---|
// Updates the records for the provided values.
private static function Update(LJCDataManager $manager)
{
$nameValue = "NameValue";
$updateValue = "Updated";
$methodName = "Update()";
$data = new LJCDbColumns();
$data->Add("Name", value: $nameValue);
$affectedCount = $manager->Add($data);
// Update the test data.
// See constructor for how to create $manager.
$keys = new LJCDbColumns();
$keys->Add("Name", value: $nameValue);
$data = new LJCDbColumns();
$data->Add("Name", value: $updateValue);
$affectedCount = $manager->Update($keys, $data);
$result = strval($affectedCount);
// result:
// 1
// $manager->SQL =
// update TableName set
// Name = 'Updated'
//
// where TableName.Name = 'NameValue'
$keys = new LJCDbColumns();
$keys->Add("Name", value: $updateValue);
$affectedCount = $manager->Delete($keys);
}
|