Stored Proc option for insert/update operation

QuestionsStored Proc option for insert/update operation
Amir asked 5 years ago

Hi,
Does the system support call for a stored procedure on update/insert?
If not, can this be implemented maybe be setting an option like this:
$grid["add_options"]["insertaction"] = "stored_procedure_name";
$grid["add_options"]["updateaction"] = "stored_procedure_name";

The system will then change the inert/update behaviour from default "INSERT INTO table …." to "CALL stored_proecdure_name(var1,var2,var3,etc)";

Is this doable?

2 Answers
Abu Ghufran answered 5 years ago

You can override default implementation of insert/update by using events on_insert and on_update.
If you want to skip default execution from phpgrid, you must set 3rd argument to false.

$e["on_insert"] = array("add_client", null, false);
$e["on_update"] = array("update_client", null, false);
$grid->set_events($e);

Refer demos/edit/custom-events.php

Abu Ghufran answered 5 years ago

In event callbacks, you can invoke your SP.

Your Answer

10 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!