List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:July 24 2008 3:04pm
Subject:RE: Log
View as plain text  
>-----Original Message-----
>From: Pedro [mailto:pedro.belmino@stripped]
>Sent: Wednesday, July 23, 2008 6:48 PM
>To: Dan Nelson
>Cc: mysql@stripped
>Subject: Re: Log
>
>I need to pass the user of my application pro bank.
>I want to log the user's application and value of new fields or fields
>updated. To then have audit of who did what.
>
[JS] We do this in our programming, where it is perhaps easier to tell which
fields are being changed. We then log the changes into a log table:

mysql> desc prod_chg;
+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| chg_id             | varchar(15)  | NO   | PRI |         |       |
| prod_id            | varchar(15)  | NO   |     |         |       |
| prod_num           | mediumint(6) | YES  |     | NULL    |       |
| prod_title         | varchar(255) | YES  |     | NULL    |       |
| prod_type          | varchar(2)   | YES  |     | NULL    |       |
| prod_vat_pct       | decimal(5,2) | YES  |     | NULL    |       |
| prod_discont       | tinyint(1)   | YES  |     | NULL    |       |
| prod_ready         | tinyint(1)   | YES  |     | NULL    |       |
| pub_id             | varchar(15)  | YES  |     | NULL    |       |
| prod_published     | date         | YES  |     | NULL    |       |
| prod_pub_prod_id   | varchar(255) | YES  |     | NULL    |       |
| prod_pub_acct_id   | varchar(2)   | YES  |     | NULL    |       |
| prod_pub_doi       | date         | YES  |     | NULL    |       |
| prod_pub_resp      | date         | YES  |     | NULL    |       |
| prod_pub_prod_url  | varchar(255) | YES  |     | NULL    |       |
| prod_rel_freq      | smallint(3)  | YES  |     | NULL    |       |
| prod_content_info  | varchar(255) | YES  |     | NULL    |       |
| prod_info_type     | varchar(5)   | YES  |     | NULL    |       |
| prod_language      | varchar(50)  | YES  |     | NULL    |       |
| prod_broch_doc     | varchar(255) | YES  |     | NULL    |       |
| prod_samp_doc      | varchar(255) | YES  |     | NULL    |       |
| prod_samp_pgs      | varchar(255) | YES  |     | NULL    |       |
| prod_exec_summ     | varchar(255) | YES  |     | NULL    |       |
| prod_toc_doc       | varchar(255) | YES  |     | NULL    |       |
| prod_e_title_tag   | varchar(255) | YES  |     | NULL    |       |
| prod_meta_tags     | varchar(255) | YES  |     | NULL    |       |
| prod_keywords      | varchar(255) | YES  |     | NULL    |       |
| prod_comments      | text         | YES  |     | NULL    |       |
| prod_if_sample_pdf | varchar(255) | YES  |     | NULL    |       |
| prod_stop_date     | date         | YES  |     | NULL    |       |
| prod_hide_web      | tinyint(1)   | YES  |     | NULL    |       |
| prod_changed       | tinyint(1)   | YES  |     | NULL    |       |
| prod_export        | tinyint(1)   | YES  |     | NULL    |       |
| prod_scoop_changed | tinyint(1)   | NO   |     | 0       |       |
| prod_on_scoop      | tinyint(1)   | NO   |     | 0       |       |
| prod_added         | datetime     | YES  |     | NULL    |       |
| prod_updated       | datetime     | YES  |     | NULL    |       |
| chg_date           | date         | YES  |     | NULL    |       |
| chg_fields         | text         | YES  |     | NULL    |       |
| chg_action         | char(1)      | YES  |     | NULL    |       |
| chg_staff_id       | varchar(15)  | YES  | MUL | NULL    |       |
+--------------------+--------------+------+-----+---------+-------+


>It is really necessary to create a trigger and a table of log for each
>table that want to monitor?
>
>What do you suggest me?
>
>Dan Nelson escreveu:
>> In the last episode (Jul 23), Pedro Belmino said:
>>
>>> I do a system log of their log everything that is done(INSERTS,
>UPDADES
>>> and DELETES). Okay, can be done with trigger. But I need to know who
>>> performed the operation. How can I get get it inside the trigger?
>>>
>>
>> Try the USER() or CURRENT_USER() functions:
>>
>> http://dev.mysql.com/doc/refman/5.0/en/information-
>functions.html#function_user
>> http://dev.mysql.com/doc/refman/5.0/en/information-
>functions.html#function_current-user
>>
>>
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>infoshop.com


Thread
LogPedro Belmino23 Jul
  • Re: LogDan Nelson23 Jul
    • Re: LogPedro24 Jul
      • Re: LogDan Nelson24 Jul
      • RE: LogJerry Schwartz24 Jul
  • Re: LogPedro23 Jul