if (it != m_pathCache.end())
return it->second;
- strSQL=PrepareSQL( "select * from path where strPath like '%s'", strPath.c_str());
+ strSQL=PrepareSQL( "select * from path where strPath='%s'", strPath.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() == 0)
{
DWORD crc = ComputeCRC(strFileName);
CStdString strSQL=PrepareSQL("select * from songview "
- "where dwFileNameCRC='%ul' and strPath like'%s'"
+ "where dwFileNameCRC='%ul' and strPath='%s'"
, crc,
strPath.c_str());
{
try
{
- CStdString strSQL=PrepareSQL("select distinct idAlbum from song join path on song.idPath = path.idPath where path.strPath like '%s'", strPath.c_str());
+ CStdString strSQL=PrepareSQL("select distinct idAlbum from song join path on song.idPath = path.idPath where path.strPath='%s'", strPath.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->eof())
return -1;
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL=PrepareSQL("select * from songview where strPath like '%s'", strPath.c_str() );
+ CStdString strSQL=PrepareSQL("select * from songview where strPath='%s'", strPath.c_str() );
if (!m_pDS->query(strSQL.c_str())) return false;
int iRowsFound = m_pDS->num_rows();
if (iRowsFound == 0)
while (!m_pDS->eof())
{
// anything that isn't a parent path of a song path is to be deleted
- CStdString sql = PrepareSQL("select count(idPath) from songpaths where strPath like '%s%%'", m_pDS->fv("strPath").get_asString().c_str());
+ CStdString path = m_pDS->fv("strPath").get_asString();
+ CStdString sql = PrepareSQL("select count(idPath) from songpaths where SUBSTR(strPath,1,%i)='%s'", StringUtils::utf8_strlen(path.c_str()), path.c_str());
if (m_pDS2->query(sql.c_str()) && m_pDS2->num_rows() == 1 && m_pDS2->fv(0).get_asInt() == 0)
deleteSQL += PrepareSQL("%i,", m_pDS->fv("idPath").get_asInt()); // nothing found, so delete
m_pDS2->close();
CStdString path, file;
URIUtils::Split(song.strFileName, path, file);
- CStdString strSQL = PrepareSQL("select albumview.* from song join albumview on song.idAlbum = albumview.idAlbum join path on song.idPath = path.idPath where song.strFileName like '%s' and path.strPath like '%s'", file.c_str(), path.c_str());
+ CStdString strSQL = PrepareSQL("select albumview.* from song join albumview on song.idAlbum = albumview.idAlbum join path on song.idPath = path.idPath where song.strFileName='%s' and path.strPath='%s'", file.c_str(), path.c_str());
if (!m_pDS->query(strSQL.c_str())) return false;
int iRowsFound = m_pDS->num_rows();
if (iRowsFound != 1)
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL=PrepareSQL("select strHash from path where strPath like '%s'", path.c_str());
+ CStdString strSQL=PrepareSQL("select strHash from path where strPath='%s'", path.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() == 0)
return false;
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString sql=PrepareSQL("select * from songview where strPath like '%s%s'", path.c_str(), (exact?"":"%"));
+ CStdString where;
+ if (exact)
+ where = PrepareSQL(" where strPath='%s'", path.c_str());
+ else
+ where = PrepareSQL(" where SUBSTR(strPath,1,%i)='%s'", StringUtils::utf8_strlen(path.c_str()), path.c_str());
+ CStdString sql = "select * from songview" + where;
if (!m_pDS->query(sql.c_str())) return false;
int iRowsFound = m_pDS->num_rows();
if (iRowsFound > 0)
AnnounceRemove("song", ids[i]);
}
// and remove the path as well (it'll be re-added later on with the new hash if it's non-empty)
- sql = PrepareSQL("delete from path where strPath like '%s%s'", path.c_str(), (exact?"":"%"));
+ sql = "delete from path" + where;
m_pDS->exec(sql.c_str());
return iRowsFound > 0;
}
if (NULL == m_pDS.get()) return false;
// wipe old settings
- CStdString strSQL = PrepareSQL("delete from content where strPath like '%s'",strPath.c_str());
+ CStdString strSQL = PrepareSQL("delete from content where strPath='%s'",strPath.c_str());
m_pDS->exec(strSQL.c_str());
// insert new settings
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL = PrepareSQL("select * from content where strPath like '%s'",strPath.c_str());
+ CStdString strSQL = PrepareSQL("select * from content where strPath='%s'",strPath.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->eof()) // no info set for path - fallback logic commencing
{
CDirectoryNode::GetDatabaseInfo(strPath, params);
if (params.GetGenreId() != -1) // check genre
{
- strSQL = PrepareSQL("select * from content where strPath like 'musicdb://1/%i/'",params.GetGenreId());
+ strSQL = PrepareSQL("select * from content where strPath='musicdb://1/%i/'",params.GetGenreId());
m_pDS->query(strSQL.c_str());
}
if (m_pDS->eof() && params.GetAlbumId() != -1) // check album
{
- strSQL = PrepareSQL("select * from content where strPath like 'musicdb://3/%i/'",params.GetGenreId());
+ strSQL = PrepareSQL("select * from content where strPath='musicdb://3/%i/'",params.GetGenreId());
m_pDS->query(strSQL.c_str());
}
if (m_pDS->eof() && params.GetArtistId() != -1) // check artist
{
- strSQL = PrepareSQL("select * from content where strPath like 'musicdb://2/%i/'",params.GetArtistId());
+ strSQL = PrepareSQL("select * from content where strPath='musicdb://2/%i/'",params.GetArtistId());
m_pDS->query(strSQL.c_str());
}
if (m_pDS->eof()) // general albums setting
{
- strSQL = PrepareSQL("select * from content where strPath like 'musicdb://3/'");
+ strSQL = PrepareSQL("select * from content where strPath='musicdb://3/'");
m_pDS->query(strSQL.c_str());
}
if (m_pDS->eof()) // general artist setting
{
- strSQL = PrepareSQL("select * from content where strPath like 'musicdb://2/'");
+ strSQL = PrepareSQL("select * from content where strPath='musicdb://2/'");
m_pDS->query(strSQL.c_str());
}
}
URIUtils::AddSlashAtEnd(strPath1);
- strSQL=PrepareSQL("select idPath from path where strPath like '%s'",strPath1.c_str());
+ strSQL=PrepareSQL("select idPath from path where strPath='%s'",strPath1.c_str());
m_pDS->query(strSQL.c_str());
if (!m_pDS->eof())
idPath = m_pDS->fv("path.idPath").get_asInt();
if (!m_pDB.get() || !m_pDS.get())
return false;
- sql = PrepareSQL("SELECT idPath,strPath FROM path WHERE strPath LIKE '%s%%'", basepath.c_str());
+ CStdString path(basepath);
+ URIUtils::AddSlashAtEnd(path);
+ sql = PrepareSQL("SELECT idPath,strPath FROM path WHERE SUBSTR(strPath,1,%i)='%s'", StringUtils::utf8_strlen(path.c_str()), path.c_str());
m_pDS->query(sql.c_str());
while (!m_pDS->eof())
{
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
- CStdString strSQL=PrepareSQL("select strHash from path where strPath like '%s'", path.c_str());
+ CStdString strSQL=PrepareSQL("select strHash from path where strPath='%s'", path.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() == 0)
return false;
while (iFound == 0 && URIUtils::GetParentPath(strPath1, strParent))
{
- strSQL=PrepareSQL("select idShow from path,tvshowlinkpath where tvshowlinkpath.idPath=path.idPath and strPath like '%s'",strParent.c_str());
+ strSQL=PrepareSQL("select idShow from path,tvshowlinkpath where tvshowlinkpath.idPath=path.idPath and strPath='%s'",strParent.c_str());
m_pDS->query(strSQL.c_str());
if (!m_pDS->eof())
{
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;
- CStdString strSQL=PrepareSQL("select tvshowlinkpath.idShow from path,tvshowlinkpath where path.strPath like '%s' and path.idPath=tvshowlinkpath.idPath",strPath.c_str());
+ CStdString strSQL=PrepareSQL("select tvshowlinkpath.idShow from path,tvshowlinkpath where path.strPath='%s' and path.idPath=tvshowlinkpath.idPath",strPath.c_str());
m_pDS->query(strSQL.c_str());
if (m_pDS->num_rows() != 0)
return m_pDS->fv("tvshowlinkpath.idShow").get_asInt();
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 like '%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 like '%s'", strPath.c_str() , strFileName.c_str());
#else
int idFile = GetFileId(strFilenameAndPath);
if (idFile < 0) return false;
{
iFound++;
- CStdString strSQL=PrepareSQL("select path.strContent,path.strScraper,path.scanRecursive,path.useFolderNames,path.strSettings,path.noUpdate from path where strPath like '%s'",strParent.c_str());
+ CStdString strSQL=PrepareSQL("select path.strContent,path.strScraper,path.scanRecursive,path.useFolderNames,path.strSettings,path.noUpdate from path where strPath='%s'",strParent.c_str());
m_pDS->query(strSQL.c_str());
CONTENT_TYPE content = CONTENT_NONE;