[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/collection/sqlcollection
From: Jeff Mitchell <mitchell () kde ! org>
Date: 2009-07-17 17:36:25
Message-ID: 1247852185.571569.18680.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 998458 by mitchell:
Fix order to prevent crashing on empty query result
M +10 -9 ScanResultProcessor.cpp
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/ScanResultProcessor.cpp \
#998457:998458 @@ -656,6 +656,15 @@
QString query = QString( "SELECT id, directory, deviceid, rpath, uniqueid FROM \
urls_temp WHERE (deviceid = %1 AND rpath = '%2') OR uniqueid='%3';" )
.arg( QString::number( deviceId ), m_collection->escape( \
rpath ), m_collection->escape( uid ) );
QStringList result = m_collection->query( query ); //tells us if the uid existed
+
+ if( result.isEmpty() ) //fresh -- insert
+ {
+ QString insert = QString( "INSERT INTO \
urls_temp(directory,deviceid,rpath,uniqueid) VALUES ( %1, %2, '%3', '%4' );" ) + \
.arg( QString::number( dirId ), QString::number( deviceId ), m_collection->escape( \
rpath ), + m_collection->escape( uid ) );
+ return m_collection->insert( insert, "urls_temp" );
+ }
+
if( result[1] == QString::number( dirId ) &&
result[2] == QString::number( deviceId ) &&
result[3] == rpath &&
@@ -665,15 +674,7 @@
//everything matches, don't need to do anything, just return the ID
return result[0].toInt();
}
-
- if( result.isEmpty() ) //fresh -- insert
- {
- QString insert = QString( "INSERT INTO \
urls_temp(directory,deviceid,rpath,uniqueid) VALUES ( %1, %2, '%3', \
'%4' );" )
- .arg( QString::number( dirId ), QString::number( deviceId ), \
m_collection->escape( rpath ),
- m_collection->escape( uid ) );
- return m_collection->insert( insert, "urls_temp" );
- }
-
+
if( result[4] == uid )
{
//we found an existing entry with this uniqueid, update the deviceid and \
path
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic