Re: Get the INSERT statement from one row in Mysql
| From: | Camilo Sperberg | Date: | Tue, 05 Nov 2013 09:40:27 +0000 |
| Subject: | Re: Get the INSERT statement from one row in Mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322422@lists.php.net to get a copy of this message | ||
On 05 Nov 2013, at 10:23, Anton Heuschen <antonfh@gmail.com> wrote:
> Good day,
>
> I am trying to find a way, how I can look for one row in a table with a
> search for the id, but then I use this to give me the INSERT statement
> (which creates this row again)
>
> What I am trying to do, is get an audit where any update - checks the state
> of a row, saves it as its INSERT statement and saves this to an audit file
> .
>
>
> Regards
>
> Anton
This is more a MySQL related question than a PHP one...
From what I know, there is no way to make MySQL generate an insert statement from an existing row.
The only way that I know about would be invoking mysqldump.
If you want an audit log, I suggest you better take a look at the binary logs from MySQL, combining
automatic backups+binary log you can easily re-assemble the structure of a table/database. Plus, the
binary log has everything you want: it logs dates and times, the exact executed queries and you can
easily take snapshots from that.
Greetings.