Possible duplicate:
Get instructions for an existing row in MySQL
Let's say we have a table called users:
CREATE TABLE IF NOT EXISTS users( UID int(11) PRIMARY KEY NOT NULL auto_increment, fname varchar(100) default NULL, lname varchar(100) default NULL, username varchar(20) default NULL UNIQUE, password blob )ENGINE=InnoDB DEFAULT CHARSET=utf8
Suppose a few rows were filled in a table. I know there is a query that returns table creation -> SHOW CREATE TABLE users But I'm looking to recreate individual insertion instructions to save them in a log ... I know this sounds weird, but I create a custom CMS where everything is logged , and, I hope, when updated / deleted rows can be rolled back at a time ... so I will need to recreate the exact insertion request from the table data (I searched the answer all over the Internet and cannot find it ...)
Is there a query that will return “automatically” a query that entered this particular string using the primary key?
I am looking for a query that would do this:
SHOW INSERT FROM users WHERE PRIMARY_KEY=2
Return:
INSERT INTO users (UID,fname,lname,username,password) VALUES (2,'somename','somelastname','someusername','someAESencryptedPassword')
The reason why I think such a query would exist / would be possible is that when backing up the database with php myadmin (cpanel) and you open the file, you can actually view each insert to recreate the table with all lines a this point in time ...
ParadoxWs
source share