| PHP |
|---|
| public function Delete(LJCDbColumns $keyColumns): int |
The $keyColumns collection parameter contains the data for the where clause.
The $keyColumns parameter is required and must have collection elements or the Delete will not be executed.| PHP |
|---|
// Creates the Delete SQL.
private static function Delete(LJCDataManager $manager)
{
$nameValue = "NameValue";
$methodName = "Delete()";
$data = new LJCDbColumns();
$data->Add("Name", value: $nameValue);
$affectedCount = $manager->Add($data);
// Delete the test data.
// See constructor for how to create $manager.
$keys = new LJCDbColumns();
$keys->Add("Name", value: $nameValue);
$affectedCount = $manager->Delete($keys);
if ($affectedCount < 1)
{
echo($manager->SQL);
}
$result = strval($affectedCount);
// result:
// 1;
// $manager->SQL =
// delete from TableName
//
// where TableName.Name = 'NameValue'
}
|