@ -81,7 +81,7 @@ CollectionDB::CollectionDB()
// Load DBEngine plugin
TQString query = " [X-KDE-Amarok-plugintype] == 'dbengine' and [X-KDE-Amarok-name] != '%1' " ;
KTrader : : OfferList offers = PluginManager : : query ( query . tq arg( " sqlite-dbengine " ) ) ;
KTrader : : OfferList offers = PluginManager : : query ( query . arg( " sqlite-dbengine " ) ) ;
m_dbEngine = ( DBEngine * ) PluginManager : : createFromService ( offers . first ( ) ) ;
//<OPEN DATABASE>
@ -272,8 +272,8 @@ CollectionDB::createTables( DbConnection *conn )
" length INTEGER, "
" samplerate INTEGER, "
" sampler BOOL ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " ) , conn ) ;
TQString albumAutoIncrement = " " ;
TQString artistAutoIncrement = " " ;
@ -302,59 +302,59 @@ CollectionDB::createTables( DbConnection *conn )
query ( TQString ( " CREATE %1 TABLE album%2 ( "
" id INTEGER PRIMARY KEY %3, "
" name " + textColumnType ( ) + " ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " )
. tq arg( albumAutoIncrement ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " )
. arg( albumAutoIncrement ) , conn ) ;
//create artist table
query ( TQString ( " CREATE %1 TABLE artist%2 ( "
" id INTEGER PRIMARY KEY %3, "
" name " + textColumnType ( ) + " ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " )
. tq arg( artistAutoIncrement ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " )
. arg( artistAutoIncrement ) , conn ) ;
//create genre table
query ( TQString ( " CREATE %1 TABLE genre%2 ( "
" id INTEGER PRIMARY KEY %3, "
" name " + textColumnType ( ) + " ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " )
. tq arg( genreAutoIncrement ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " )
. arg( genreAutoIncrement ) , conn ) ;
//create year table
query ( TQString ( " CREATE %1 TABLE year%2 ( "
" id INTEGER PRIMARY KEY %3, "
" name " + textColumnType ( ) + " ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " )
. tq arg( yearAutoIncrement ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " )
. arg( yearAutoIncrement ) , conn ) ;
//create images table
query ( TQString ( " CREATE %1 TABLE images%2 ( "
" path " + textColumnType ( ) + " , "
" artist " + textColumnType ( ) + " , "
" album " + textColumnType ( ) + " ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " ) , conn ) ;
// create directory statistics table
query ( TQString ( " CREATE %1 TABLE directories%2 ( "
" dir " + textColumnType ( ) + " UNITQUE, "
" changedate INTEGER ); " )
. tq arg( conn ? " TEMPORARY " : " " )
. tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " TEMPORARY " : " " )
. arg( conn ? " _temp " : " " ) , conn ) ;
//create indexes
query ( TQString ( " CREATE INDEX album_idx%1 ON album%2( name ); " )
. tq arg( conn ? " _temp " : " " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " _temp " : " " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " CREATE INDEX artist_idx%1 ON artist%2( name ); " )
. tq arg( conn ? " _temp " : " " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " _temp " : " " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " CREATE INDEX genre_idx%1 ON genre%2( name ); " )
. tq arg( conn ? " _temp " : " " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " _temp " : " " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " CREATE INDEX year_idx%1 ON year%2( name ); " )
. tq arg( conn ? " _temp " : " " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
. arg( conn ? " _temp " : " " ) . arg( conn ? " _temp " : " " ) , conn ) ;
if ( ! conn )
{
@ -385,13 +385,13 @@ CollectionDB::dropTables( DbConnection *conn )
{
DEBUG_FUNC_INFO
query ( TQString ( " DROP TABLE tags%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE album%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE artist%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE genre%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE year%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE images%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE directories%1; " ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE tags%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE album%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE artist%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE genre%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE year%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE images%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " DROP TABLE directories%1; " ) . arg( conn ? " _temp " : " " ) , conn ) ;
if ( ! conn )
{
query ( TQString ( " DROP TABLE related_artists; " ) ) ;
@ -421,16 +421,16 @@ CollectionDB::clearTables( DbConnection *conn )
clearCommand = " TRUNCATE TABLE " ;
}
query ( TQString ( " %1 tags%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 album%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 artist%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 genre%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 year%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 images%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 directories%2; " ) . tq arg( clearCommand ) . tq arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 tags%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 album%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 artist%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 genre%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 year%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 images%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
query ( TQString ( " %1 directories%2; " ) . arg( clearCommand ) . arg( conn ? " _temp " : " " ) , conn ) ;
if ( ! conn )
{
query ( TQString ( " %1 related_artists; " ) . tq arg( clearCommand ) ) ;
query ( TQString ( " %1 related_artists; " ) . arg( clearCommand ) ) ;
}
}
@ -584,16 +584,16 @@ CollectionDB::IDFromValue( TQString name, TQString value, bool autocreate, const
TQStringList values =
query ( TQString (
" SELECT id, name FROM %1 WHERE name LIKE '%2'; " )
. tq arg( name )
. tq arg( CollectionDB : : instance ( ) - > escapeString ( value ) ) , conn ) ;
. arg( name )
. arg( CollectionDB : : instance ( ) - > escapeString ( value ) ) , conn ) ;
if ( updateSpelling & & ! values . isEmpty ( ) & & ( values [ 1 ] ! = value ) )
{
query ( TQString ( " UPDATE %1 SET id = %2, name = '%3' WHERE id = %4; " )
. tq arg( name )
. tq arg( values . first ( ) )
. tq arg( CollectionDB : : instance ( ) - > escapeString ( value ) )
. tq arg( values . first ( ) ) , conn ) ;
. arg( name )
. arg( values . first ( ) )
. arg( CollectionDB : : instance ( ) - > escapeString ( value ) )
. arg( values . first ( ) ) , conn ) ;
}
//check if item exists. if not, should we autocreate it?
@ -601,8 +601,8 @@ CollectionDB::IDFromValue( TQString name, TQString value, bool autocreate, const
if ( values . isEmpty ( ) & & autocreate )
{
id = insert ( TQString ( " INSERT INTO %1 ( name ) VALUES ( '%2' ); " )
. tq arg( name )
. tq arg( CollectionDB : : instance ( ) - > escapeString ( value ) ) , name , conn ) ;
. arg( name )
. arg( CollectionDB : : instance ( ) - > escapeString ( value ) ) , name , conn ) ;
return id ;
}
@ -617,8 +617,8 @@ CollectionDB::valueFromID( TQString table, uint id )
TQStringList values =
query ( TQString (
" SELECT name FROM %1 WHERE id=%2; " )
. tq arg( table )
. tq arg( id ) ) ;
. arg( table )
. arg( id ) ) ;
return values . isEmpty ( ) ? 0 : values . first ( ) ;
@ -631,8 +631,8 @@ CollectionDB::albumSongCount( const TQString &artist_id, const TQString &album_i
TQStringList values =
query ( TQString (
" SELECT COUNT( url ) FROM tags WHERE album = %1 AND artist = %2; " )
. tq arg( album_id )
. tq arg( artist_id ) ) ;
. arg( album_id )
. arg( artist_id ) ) ;
return values . first ( ) ;
}
@ -642,8 +642,8 @@ CollectionDB::albumIsCompilation( const TQString &album_id )
TQStringList values =
query ( TQString (
" SELECT sampler FROM tags WHERE sampler=%1 AND album=%2 " )
. tq arg( CollectionDB : : instance ( ) - > boolT ( ) )
. tq arg( album_id ) ) ;
. arg( CollectionDB : : instance ( ) - > boolT ( ) )
. arg( album_id ) ) ;
return ( values . count ( ) ! = 0 ) ;
}
@ -655,17 +655,17 @@ CollectionDB::albumTracks( const TQString &artist_id, const TQString &album_id )
return query ( TQString ( " SELECT tags.url, tags.track AS __discard FROM tags, year WHERE tags.album = %1 AND "
" ( tags.sampler = %2 OR tags.artist = %3 ) AND year.id = tags.year "
" ORDER BY tags.track; " )
. tq arg( album_id )
. tq arg( boolT ( ) )
. tq arg( artist_id ) ) ;
. arg( album_id )
. arg( boolT ( ) )
. arg( artist_id ) ) ;
}
else
{
return query ( TQString ( " SELECT tags.url FROM tags, year WHERE tags.album = %1 AND "
" ( tags.sampler = 1 OR tags.artist = %2 ) AND year.id = tags.year "
" ORDER BY tags.track; " )
. tq arg( album_id )
. tq arg( artist_id ) ) ;
. arg( album_id )
. arg( artist_id ) ) ;
}
}
@ -680,10 +680,10 @@ CollectionDB::addImageToAlbum( const TQString& image, TQValueList< TQPair<TQStri
debug ( ) < < " Added image for album: " < < ( * it ) . first < < " - " < < ( * it ) . second < < " : " < < image < < endl ;
insert ( TQString ( " INSERT INTO images%1 ( path, artist, album ) VALUES ( '%1', '%2', '%3' ); " )
. tq arg( conn ? " _temp " : " " )
. tq arg( escapeString ( image ) )
. tq arg( escapeString ( ( * it ) . first ) )
. tq arg( escapeString ( ( * it ) . second ) ) , NULL , conn ) ;
. arg( conn ? " _temp " : " " )
. arg( escapeString ( image ) )
. arg( escapeString ( ( * it ) . first ) )
. arg( escapeString ( ( * it ) . second ) ) , NULL , conn ) ;
}
}
@ -879,8 +879,8 @@ CollectionDB::getImageForAlbum( const TQString& artist, const TQString& album, u
TQStringList values =
query ( TQString (
" SELECT path FROM images WHERE artist LIKE '%1' AND album LIKE '%2' ORDER BY path; " )
. tq arg( escapeString ( artist ) )
. tq arg( escapeString ( album ) ) ) ;
. arg( escapeString ( artist ) )
. arg( escapeString ( album ) ) ) ;
if ( ! values . isEmpty ( ) )
{
@ -1165,7 +1165,7 @@ CollectionDB::bundleForUrl( MetaBundle* bundle )
" FROM tags, album, artist, genre, year "
" WHERE album.id = tags.album AND artist.id = tags.artist AND "
" genre.id = tags.genre AND year.id = tags.year AND tags.url = '%1'; " )
. tq arg( escapeString ( bundle - > url ( ) . path ( ) ) ) ) ;
. arg( escapeString ( bundle - > url ( ) . path ( ) ) ) ) ;
if ( ! values . empty ( ) )
fillInBundle ( values , * bundle ) ;
@ -1260,10 +1260,10 @@ void
CollectionDB : : addAudioproperties ( const MetaBundle & bundle )
{
query ( TQString ( " UPDATE tags SET bitrate='%1', length='%2', samplerate='%3' WHERE url='%4'; " )
. tq arg( bundle . bitrate ( ) )
. tq arg( bundle . length ( ) )
. tq arg( bundle . sampleRate ( ) )
. tq arg( escapeString ( bundle . url ( ) . path ( ) ) ) ) ;
. arg( bundle . bitrate ( ) )
. arg( bundle . length ( ) )
. arg( bundle . sampleRate ( ) )
. arg( escapeString ( bundle . url ( ) . path ( ) ) ) ) ;
}
@ -1275,7 +1275,7 @@ CollectionDB::addSongPercentage( const TQString &url, int percentage )
query ( TQString (
" SELECT playcounter, createdate, percentage FROM statistics "
" WHERE url = '%1'; " )
. tq arg( escapeString ( url ) ) ) ;
. arg( escapeString ( url ) ) ) ;
// check boundaries
if ( percentage > 100 ) percentage = 100 ;
@ -1288,19 +1288,19 @@ CollectionDB::addSongPercentage( const TQString &url, int percentage )
if ( m_dbConnPool - > getDbConnectionType ( ) = = DbConnection : : postgresql ) {
query ( TQString ( " UPDATE statistics SET percentage=%1, playcounter=%2+1 WHERE url='%3'; " )
. tq arg( score )
. tq arg( values [ 0 ] + " + 1 " )
. tq arg( escapeString ( url ) ) ) ;
. arg( score )
. arg( values [ 0 ] + " + 1 " )
. arg( escapeString ( url ) ) ) ;
}
else
{
query ( TQString ( " REPLACE INTO statistics ( url, createdate, accessdate, percentage, playcounter ) "
" VALUES ( '%1', %2, %3, %4, %5 ); " )
. tq arg( escapeString ( url ) )
. tq arg( values [ 1 ] )
. tq arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. tq arg( score )
. tq arg( values [ 0 ] + " + 1 " ) ) ;
. arg( escapeString ( url ) )
. arg( values [ 1 ] )
. arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. arg( score )
. arg( values [ 0 ] + " + 1 " ) ) ;
}
}
else
@ -1310,10 +1310,10 @@ CollectionDB::addSongPercentage( const TQString &url, int percentage )
insert ( TQString ( " INSERT INTO statistics ( url, createdate, accessdate, percentage, playcounter ) "
" VALUES ( '%1', %2, %3, %4, 1 ); " )
. tq arg( escapeString ( url ) )
. tq arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. tq arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. tq arg( score ) , NULL ) ;
. arg( escapeString ( url ) )
. arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. arg( score ) , NULL ) ;
}
int iscore = getSongPercentage ( url ) ;
@ -1326,7 +1326,7 @@ int
CollectionDB : : getSongPercentage ( const TQString & url )
{
TQStringList values = query ( TQString ( " SELECT round( percentage + 0.4 ) FROM statistics WHERE url = '%1'; " )
. tq arg( escapeString ( url ) ) ) ;
. arg( escapeString ( url ) ) ) ;
if ( values . count ( ) )
return values . first ( ) . toInt ( ) ;
@ -1341,7 +1341,7 @@ CollectionDB::setSongPercentage( const TQString &url , int percentage )
TQStringList values =
query ( TQString (
" SELECT playcounter, createdate, accessdate FROM statistics WHERE url = '%1'; " )
. tq arg( escapeString ( url ) ) ) ;
. arg( escapeString ( url ) ) ) ;
// check boundaries
if ( percentage > 100 ) percentage = 100 ;
@ -1351,29 +1351,29 @@ CollectionDB::setSongPercentage( const TQString &url , int percentage )
{
if ( m_dbConnPool - > getDbConnectionType ( ) = = DbConnection : : postgresql ) {
query ( TQString ( " UPDATE statistics SET percentage=%1 WHERE url='%2'; " )
. tq arg( percentage )
. tq arg( escapeString ( url ) ) ) ;
. arg( percentage )
. arg( escapeString ( url ) ) ) ;
}
else
{
// entry exists
query ( TQString ( " REPLACE INTO statistics ( url, createdate, accessdate, percentage, playcounter ) "
" VALUES ( '%1', '%2', '%3', %4, %5 ); " )
. tq arg( escapeString ( url ) )
. tq arg( values [ 1 ] )
. tq arg( values [ 2 ] )
. tq arg( percentage )
. tq arg( values [ 0 ] ) ) ;
. arg( escapeString ( url ) )
. arg( values [ 1 ] )
. arg( values [ 2 ] )
. arg( percentage )
. arg( values [ 0 ] ) ) ;
}
}
else
{
insert ( TQString ( " INSERT INTO statistics ( url, createdate, accessdate, percentage, playcounter ) "
" VALUES ( '%1', %2, %3, %4, 0 ); " )
. tq arg( escapeString ( url ) )
. tq arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. tq arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. tq arg( percentage ) , NULL ) ;
. arg( escapeString ( url ) )
. arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. arg( TQDateTime : : currentDateTime ( ) . toTime_t ( ) )
. arg( percentage ) , NULL ) ;
}
emit scoreChanged ( url , percentage ) ;
@ -1388,16 +1388,16 @@ CollectionDB::updateDirStats( TQString path, const long datetime, DbConnection *
if ( m_dbConnPool - > getDbConnectionType ( ) = = DbConnection : : postgresql ) {
query ( TQString ( " UPDATE directories%1 SET changedate=%2 WHERE dir='%3'; " )
. tq arg( conn ? " _temp " : " " )
. tq arg( datetime )
. tq arg( escapeString ( path ) ) , conn ) ;
. arg( conn ? " _temp " : " " )
. arg( datetime )
. arg( escapeString ( path ) ) , conn ) ;
}
else
{
query ( TQString ( " REPLACE INTO directories%1 ( dir, changedate ) VALUES ( '%3', %2 ); " )
. tq arg( conn ? " _temp " : " " )
. tq arg( datetime )
. tq arg( escapeString ( path ) ) ,
. arg( conn ? " _temp " : " " )
. arg( datetime )
. arg( escapeString ( path ) ) ,
conn ) ;
}
}
@ -1410,7 +1410,7 @@ CollectionDB::removeSongsInDir( TQString path )
path = path . left ( path . length ( ) - 1 ) ;
query ( TQString ( " DELETE FROM tags WHERE dir = '%1'; " )
. tq arg( escapeString ( path ) ) ) ;
. arg( escapeString ( path ) ) ) ;
}
@ -1422,7 +1422,7 @@ CollectionDB::isDirInCollection( TQString path )
TQStringList values =
query ( TQString ( " SELECT changedate FROM directories WHERE dir = '%1'; " )
. tq arg( escapeString ( path ) ) ) ;
. arg( escapeString ( path ) ) ) ;
return ! values . isEmpty ( ) ;
}
@ -1433,7 +1433,7 @@ CollectionDB::isFileInCollection( const TQString &url )
{
TQStringList values =
query ( TQString ( " SELECT url FROM tags WHERE url = '%1'; " )
. tq arg( escapeString ( url ) ) ) ;
. arg( escapeString ( url ) ) ) ;
return ! values . isEmpty ( ) ;
}
@ -1445,7 +1445,7 @@ CollectionDB::removeSongs( const KURL::List& urls )
for ( KURL : : List : : ConstIterator it = urls . begin ( ) , end = urls . end ( ) ; it ! = end ; + + it )
{
query ( TQString ( " DELETE FROM tags WHERE url = '%1'; " )
. tq arg( escapeString ( ( * it ) . path ( ) ) ) ) ;
. arg( escapeString ( ( * it ) . path ( ) ) ) ) ;
}
}
@ -1457,12 +1457,12 @@ CollectionDB::similarArtists( const TQString &artist, uint count )
if ( m_dbConnPool - > getDbConnectionType ( ) = = DbConnection : : postgresql ) {
values = query ( TQString ( " SELECT suggestion FROM related_artists WHERE artist = '%1' OFFSET 0 LIMIT %2; " )
. tq arg( escapeString ( artist ) ) . tq arg( count ) ) ;
. arg( escapeString ( artist ) ) . arg( count ) ) ;
}
else
{
values = query ( TQString ( " SELECT suggestion FROM related_artists WHERE artist = '%1' LIMIT 0, %2; " )
. tq arg( escapeString ( artist ) ) . tq arg( count ) ) ;
. arg( escapeString ( artist ) ) . arg( count ) ) ;
}
if ( values . isEmpty ( ) )
@ -1480,8 +1480,8 @@ CollectionDB::checkCompilations( const TQString &path, const bool temporary, DbC
TQStringList dirs ;
albums = query ( TQString ( " SELECT DISTINCT album.name FROM tags_temp, album%1 AS album WHERE tags_temp.dir = '%2' AND album.id = tags_temp.album; " )
. tq arg( temporary ? " _temp " : " " )
. tq arg( escapeString ( path ) ) , conn ) ;
. arg( temporary ? " _temp " : " " )
. arg( escapeString ( path ) ) , conn ) ;
for ( uint i = 0 ; i < albums . count ( ) ; i + + )
{
@ -1489,16 +1489,16 @@ CollectionDB::checkCompilations( const TQString &path, const bool temporary, DbC
const uint album_id = albumID ( albums [ i ] , false , temporary , false , conn ) ;
artists = query ( TQString ( " SELECT DISTINCT artist.name FROM tags_temp, artist%1 AS artist WHERE tags_temp.album = '%2' AND tags_temp.artist = artist.id; " )
. tq arg( temporary ? " _temp " : " " )
. tq arg( album_id ) , conn ) ;
. arg( temporary ? " _temp " : " " )
. arg( album_id ) , conn ) ;
dirs = query ( TQString ( " SELECT DISTINCT dir FROM tags_temp WHERE album = '%1'; " )
. tq arg( album_id ) , conn ) ;
. arg( album_id ) , conn ) ;
if ( artists . count ( ) > dirs . count ( ) )
{
debug ( ) < < " Detected compilation: " < < albums [ i ] < < " - " < < artists . count ( ) < < " : " < < dirs . count ( ) < < endl ;
query ( TQString ( " UPDATE tags_temp SET sampler = %1 WHERE album = '%2'; " )
. tq arg( boolT ( ) ) . tq arg( album_id ) , conn ) ;
. arg( boolT ( ) ) . arg( album_id ) , conn ) ;
}
}
}
@ -1508,8 +1508,8 @@ void
CollectionDB : : setCompilation ( const TQString & album , const bool enabled , const bool updateView )
{
query ( TQString ( " UPDATE tags, album SET tags.sampler = %1 WHERE tags.album = album.id AND album.name = '%2'; " )
. tq arg( enabled ? " 1 " : " 0 " )
. tq arg( escapeString ( album ) ) ) ;
. arg( enabled ? " 1 " : " 0 " )
. arg( escapeString ( album ) ) ) ;
// Update the Collection-Browser view,
// using TQTimer to make sure we don't manipulate the GUI from a thread
@ -1525,7 +1525,7 @@ CollectionDB::removeDirFromCollection( TQString path )
path = path . left ( path . length ( ) - 1 ) ;
query ( TQString ( " DELETE FROM directories WHERE dir = '%1'; " )
. tq arg( escapeString ( path ) ) ) ;
. arg( escapeString ( path ) ) ) ;
}
@ -1755,13 +1755,13 @@ class SimilarArtistsInsertionJob : public ThreadWeaver::DependentJob
{
virtual bool doJob ( )
{
CollectionDB : : instance ( ) - > query ( TQString ( " DELETE FROM related_artists WHERE artist = '%1'; " ) . tq arg( escapedArtist ) ) ;
CollectionDB : : instance ( ) - > query ( TQString ( " DELETE FROM related_artists WHERE artist = '%1'; " ) . arg( escapedArtist ) ) ;
const TQString sql = " INSERT INTO related_artists ( artist, suggestion, changedate ) VALUES ( '%1', '%2', 0 ); " ;
foreach ( suggestions )
CollectionDB : : instance ( ) - > insert ( sql
. tq arg( escapedArtist )
. tq arg( CollectionDB : : instance ( ) - > escapeString ( * it ) ) , NULL ) ;
. arg( escapedArtist )
. arg( CollectionDB : : instance ( ) - > escapeString ( * it ) ) , NULL ) ;
return true ;
}