Permalink
Browse files

don't use LIKE for strFileName compares, as stack://, rar:// and zip:…

…// use strFileName to store the complete paths, and mysql + DOS style paths == fail. Fixes #9022.
  • Loading branch information...
1 parent 58d9a80 commit 20904059bec9c5878e7d8cbdd04681431c7545ce Jonathan Marshall committed May 12, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 xbmc/video/VideoDatabase.cpp
@@ -651,7 +651,7 @@ int CVideoDatabase::AddFile(const CStdString& strFileNameAndPath)
if (idPath < 0)
return -1;
- CStdString strSQL=PrepareSQL("select idFile from files where strFileName like '%s' and idPath=%i", strFileName.c_str(),idPath);
+ CStdString strSQL=PrepareSQL("select idFile from files where strFileName='%s' and idPath=%i", strFileName.c_str(),idPath);
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() > 0)
@@ -842,7 +842,7 @@ int CVideoDatabase::GetFileId(const CStdString& strFilenameAndPath)
if (idPath >= 0)
{
CStdString strSQL;
- strSQL=PrepareSQL("select idFile from files where strFileName like '%s' and idPath=%i", strFileName.c_str(),idPath);
+ strSQL=PrepareSQL("select idFile from files where strFileName='%s' and idPath=%i", strFileName.c_str(),idPath);
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() > 0)
{
@@ -3139,7 +3139,7 @@ bool CVideoDatabase::GetVideoSettings(const CStdString &strFilenameAndPath, CVid
if (NULL == m_pDS.get()) return false;
CStdString strPath, strFileName;
URIUtils::Split(strFilenameAndPath, strPath, strFileName);
- CStdString strSQL=PrepareSQL("select * from settings, files, path where settings.idFile=files.idFile and path.idPath=files.idPath and path.strPath='%s' and files.strFileName like '%s'", strPath.c_str() , strFileName.c_str());
+ CStdString strSQL=PrepareSQL("select * from settings, files, path where settings.idFile=files.idFile and path.idPath=files.idPath and path.strPath='%s' and files.strFileName='%s'", strPath.c_str() , strFileName.c_str());
#else
int idFile = GetFileId(strFilenameAndPath);
if (idFile < 0) return false;

0 comments on commit 2090405

Please sign in to comment.