diff -r 065198191975 -r 5723da102db1 qtinternetradio/irdb/src/urlinfowrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/irdb/src/urlinfowrapper.cpp Fri Sep 17 08:27:59 2010 +0300 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Description: +* +*/ + +#include +#include +#include + +#include "urlinfowrapper.h" +#include "irdb.h" + +urlInfoWrapper::urlInfoWrapper() +{ +} + +urlInfoWrapper::~urlInfoWrapper() +{ +} + +bool urlInfoWrapper::resetUrlInfo(const columnUrlInfoInsertMap* const RowData, + const uint& channelId) +{ + QStringList insSqlStrList; + + if(!channelId) + { + return false; + } + + if( NULL == RowData ) + { + return false; + } + + if(RowData->isEmpty()) + { + return false; + } + + combineInsertStr(RowData, channelId, insSqlStrList); + return m_pIRDB->resetUrlInfo(insSqlStrList, channelId)? false:true; +} + +void urlInfoWrapper::combineInsertStr(const columnUrlInfoInsertMap* const RowData, + const uint& channelId, + QStringList& insSqlStrList) +{ + columnUrlInfoInsertMap::const_iterator it; + QString insSqlStr; + it = RowData->begin(); + while(it != RowData->end()) + { + insSqlStr = "Insert into urlinfo(channelUrl, channelId, bitrate) values("; + insSqlStr += "'" +it.key()+ "'" +", "; + insSqlStr += QString::number(channelId); + insSqlStr += ", "; + insSqlStr += QString::number(it.value()); + insSqlStr += " )" ; + + insSqlStrList<* urlInfoWrapper::getUrlInfo(const columnMap* const condAND, + const columnMap* const condOR) +{ + QString sltSqlStr = "select channelUrl, channelId, bitRate from urlInfo "; + QList* pDataSet = NULL; + + if( (NULL != condAND)&&(NULL != condOR) ) + { + return NULL; + } + + if(condAND) + { + if(condAND->isEmpty()) + { + return false; + } + } + + if(condOR) + { + if(condOR->isEmpty()) + { + return false; + } + } + + combineGetStr(condAND, condOR, colNameView, sltSqlStr); + pDataSet = new QList(); + if( m_pIRDB->selectRow(this, sltSqlStr, pDataSet) ) + { + delete pDataSet; + pDataSet = NULL; + } + + return pDataSet; +} + +bool urlInfoWrapper::getIRTableCB(QSqlQuery& aIRDataSet, QList* pDataSet) +{ + while (aIRDataSet.next()) + { + QVariant* const p = new QVariant[IRDB_URLINFO_COLUMN]; + *pDataSet<