Hello,
What exactly do you mean by JSON operations ?
Please give some examples.
Thanks
Hi,
For add/update/delete operations.
If a user has update a row, we can have for exemple in the json.log :
year.month.day hour:minute operation session_id db_name.table_name query_information
2013.12.06 12:00 update 123456 prod_db.articles update articles set color=red where id=123
2013.12.06 12:30 delete 234455 prod_db.articles delete from articles where id=789
2013.12.06 12:32 update 123456 prod_db.articles update article set price=50 where id=123
Somethings like that. Maybe it's already existed with JSON.php lib ?
Hello,
Not sure for JSON.php as it is a failover for php build-in JSON.
If you want to log Add/Edit/Del operations, you can log them using custom events.
For e.g.
// params are array(<function-name>,<class-object> or <null-if-global-func>,<continue-default-operation>)
// if you pass last argument as true, functions will act as a data filter, and insert/update will be performed by grid
$e["on_insert"] = array("add_client", null, true);
$e["on_update"] = array("update_client", null, true);
$e["on_delete"] = array("delete_client", null, true);
$grid->set_events($e);
function update_client($data)
{
// logging code
}
and so on. Refer demos/editing/custom-events.php for code.
I'm also interested in this logging.
Do you have a complete code for this?
I'm using sqlserver and want to log all these avtivities into a simple table.
I think I need a little help here…
Logging demo is not ready yet. It would be simple if you follow demos/editing/custom-events.php
$e["on_insert"] = array("add_callback", null, true);
$e["on_update"] = array("update_callback", null, true);
$e["on_delete"] = array("delete_callback", null, true);
$grid->set_events($e);
function add_callback($data)
{
// logging code
}
function update_callback($data)
{
// logging code
}
function delete_callback($data)
{
// logging code
}
$data contains posted data, you can use print_r for further help.
I'm sorry. I'm not so good in this so I need more help.
Where should I put "$grid->set_events($e);"?
If I put in this in my code, the webpage does not output anything. Even if I don't have any code inside my new function.
And I can't find any complete example using the event function.
Hello Arne,
Please email me your existing code at [email protected].
I'll update the code with logging events and reply you back.
Regards,