fausto astudillo
|
| Posted: 12/14/2004, 6:30 AM |
|
I have follow the generated code for a ds (Data source) component and I saw :
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert");
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert");
if($this->Errors->Count() > 0)
$this->Errors->AddError($this->Errors->ToString());
$this->close();
. The result of BeforeExecuteInsert event does nothing respect of execution of the Insert Query.
. A good practice shoulb be a validation of CCSEventResult and a conditional execution of the folowwing sentences.
. Actually the solution is to put NULL on the sql sentence inside the BeforeExecuteInsert event to avoid its execution.
. Idem for other events.
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 12/14/2004, 6:46 AM |
|
Hello,
I think that you’re using lower version CCS that I do. I’m using CCS 2.3.2.24 and it provides an ability to fornid sql execution from Before Execute Update/Insert/delete events:
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteUpdate");
if($this->Errors->Count() == 0 && $this->CmdExecution) {
$this->query($this->SQL);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteUpdate");
}
So you can prevent sql execution assigning an error or setting CmdExecution to false
$form_name->Errors->AddError("Error message");
// or
$form_name->ds->CmdExecution= false;
This new feature let you prevent update of a certain row of editable grid.
_________________
Regards,
Nicole |
 |
 |
fausto astudillo
|
| Posted: 12/14/2004, 7:22 AM |
|
Hi, Nicole:
Yow have reason. I'm using an older version.
Thanks.
Have a nice season!.
|
|
|
 |
|