1
I wonder if there is another technique to make records of modifications in the tables without going through triggers ?
1
I wonder if there is another technique to make records of modifications in the tables without going through triggers ?
0
André, good morning
If it is via some language, like PHP for example, you can create a log for example:
<?php
function gravaLog($text){
$data = date("d-m-y");
$hora = date("H:i:s");
$arquivo = $data.".txt";
$texto = "[$hora] - $msg \n";
$arr = fopen("$arquivo", "a+b");
fwrite($aar, $texto);
fclose($aar);
}
?>
Then to each function that manipulates the bank you would call, example:
function insereBanco($reg){
//sua funcao
gravaLog("O registro " . $reg . " foi inserido no banco")
}
function alteraBanco($reg){
//sua funcao
gravaLog("O registro " . $reg . " foi alterado no banco")
}
function deletaBanco($reg){
//sua funcao
gravaLog("O registro " . $reg . " foi excluido no banco")
}
I note that the function gravaLog() is being called after another function : Imagine that it is a function that makes a update on the table y. How the function would record the data that has been modified ?
These other functions were just to simulate your process. You can use it anywhere in your code @Andrépka
Okay... but she holds the die before it’s changed ?
Browser other questions tagged mysql sql phpmyadmin trigger
You are not signed in. Login or sign up in order to post.
There are ways to do it via synchronization between databases. However, with writing in tables in the same database I don’t know any other way. In time, as was the question http://answall.com/questions/172540/como-crea-um-trigger-pra-uma-coluna-especifica-de-umatable?
– E.Thomas
@E.Thomas the question has not been solved, which is why I intend to migrate to another technique !
– PululuK
@E.Thomas was disappointed to see that the question had a negative notation.. I could not understand the reason why !
– PululuK
Nor did I understand the reason. I wonder if my answer was satisfactory, and if it was, if you can mark it as such.
– E.Thomas
@E.Thomas your answer was satisfactory enough, I will do some more research on... Thanks !
– PululuK
want to log what has been modified?
– Daniel Omine
@Danielomine plan to record the data that has been modified ( old data)
– PululuK
@Andrépka direct modification in the base or via some programming language?
– Lucas Torres
@Lucastorres with a tongue or directly, the two forms are valid for my case !
– PululuK
It would be the case to implement Audit ? https://dev.mysql.com/doc/refman/5.5/en/audit-log.html
– Motta