2013-11-18, 23:55
i have a script i wrote that will update a file in xbmc's mysql library instead of removing and adding a new one. here is the qery used to do so:
it has worked file for me but i shared it with someone and they are getting an issue where instead of updating the record, a new one is created. i verified this with a COUNT query. before the update there is 1 count of the filename in the table, 0 of the new file. after the update there is one count of each instead of 0 of the old and 1 of the new, as it is for my system. i looked at it and for some reason it is auto-incrementing instead of updating the row. could this be a rights/permissions issue? any ideas?
Code:
START TRANSACTION;
UPDATE MyVideos75.files
SET strFilename="'$NFescaped'"
WHERE strFilename="'$DFescaped'";
UPDATE MyVideos75.episode
SET c18 =
(SELECT concat (
(SELECT strPath
FROM MyVideos75.path
WHERE path.idpath=
(SELECT idpath
FROM MyVideos75.files
WHERE strFilename="'$NFescaped'")), "'$NFescaped'"))
WHERE c18 =
(SELECT concat (
(SELECT strPath
FROM MyVideos75.path
WHERE path.idpath=
(SELECT idpath
FROM MyVideos75.files
WHERE strFilename="'$NFescaped'")), "'$DFescaped'"));
COMMIT
it has worked file for me but i shared it with someone and they are getting an issue where instead of updating the record, a new one is created. i verified this with a COUNT query. before the update there is 1 count of the filename in the table, 0 of the new file. after the update there is one count of each instead of 0 of the old and 1 of the new, as it is for my system. i looked at it and for some reason it is auto-incrementing instead of updating the row. could this be a rights/permissions issue? any ideas?