Kodi Community Forum

Full Version: will this work? import watched status from backup using mysql
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a corrupted mysql xbmc_video database, but the files table is allright.
I made a backup of this table and named it filesbackup. Then I recreated the xbmc_video database by letting xbmc scrape all my files into a new library.
Due to this, I lost my watched status. I'm trying to restore this by inserting the old values from the filesbackup table into the new files table but I'm not really sure how to do this.

So far I wrote this statement:

insert into
files (playcount, lastplayed)
select filesbackup.playcount, filesbackup.lastplayed
from files, filesbackup
where files.strfilename = filesbackup.strfilename

Will this work? Is this statement correct? If not: could someone help me to change it so that it will work?

Thanks!
xburchartz Wrote:insert into
files (playcount, lastplayed)
select filesbackup.playcount, filesbackup.lastplayed
from files, filesbackup
where files.strfilename = filesbackup.strfilename

Will this work? Is this statement correct? If not: could someone help me to change it so that it will work?
You could do it the way you are attempting (although your sql needs some tuning), but what I would do is use MySQL workbench (or MySQL administrator) to export the filesbackuptable as a .sql file, open the file up, replace all references of filesbackup with files, and then execute that .sql file. This will replace your current files table with the backed up one
bradvido88 Wrote:You could do it the way you are attempting (although your sql needs some tuning), but what I would do is use MySQL workbench (or MySQL administrator) to export the filesbackuptable as a .sql file, open the file up, replace all references of filesbackup with files, and then execute that .sql file. This will replace your current files table with the backed up one

Thanks, I used TOAD and created a temporary new table filesnew from the files table. In this new table I inserted the rows I needed. Then I renamed the filesnew to files. Everything works now Smile