qtinternetradio/irdb/src/imgwrapper.cpp
changeset 17 38bbf2dcd608
parent 16 5723da102db1
equal deleted inserted replaced
16:5723da102db1 17:38bbf2dcd608
    33 {
    33 {
    34     QString insSqlStr;
    34     QString insSqlStr;
    35     QString updSqlStr;
    35     QString updSqlStr;
    36     QList<QByteArray>* pImgList = NULL;
    36     QList<QByteArray>* pImgList = NULL;
    37     bool ret = true;
    37     bool ret = true;
       
    38     int logoType;
    38     
    39     
    39     if(!channelId)
    40     if(!channelId)
    40     {
    41     {
    41         return false;	
    42         return false;	
    42     }
    43     }
    43 
    44 
    44     if( NULL == RowData )
    45     if( ( NULL == RowData )&&(NULL ==logoData) )
    45     {
    46     {
    46         return false;
    47         return false;
    47     }
    48     }
       
    49     if(RowData)
       
    50     {
       
    51         if(RowData->isEmpty())
       
    52         {
       
    53             return false;
       
    54         }
    48 
    55 
    49     if(RowData->isEmpty())
    56         if( true != (RowData->value(channelId)).isEmpty() )
    50     {
    57         {
    51         return false;
    58             return false;
    52     }
    59         }
    53 
    60     }    
    54     if( true != (RowData->value(channelId)).isEmpty() )
       
    55     {
       
    56         return false;
       
    57     }
       
    58 
    61 
    59     updSqlStr = "update img set ";
    62     updSqlStr = "update img set ";
    60     if(NULL != logoData)
    63     if(NULL != logoData)
    61      {
    64      {
    62          pImgList = new QList<QByteArray>();
    65          pImgList = new QList<QByteArray>();
    63          combinePutStr(RowData, colNameView, insSqlStr, updSqlStr, logoData, pImgList); 
    66          combinePutStr(RowData, colNameView, insSqlStr, updSqlStr, logoData, pImgList, &logoType); 
    64      
    67      
    65      }
    68      }
    66      else
    69      else
    67      {
    70      {
    68          combinePutStr(RowData, colNameView, insSqlStr, updSqlStr);
    71          combinePutStr(RowData, colNameView, insSqlStr, updSqlStr);
    69      }  
    72      }  
    70     
    73     
    71     //create insSqlstr and updSqlStr in advance;
    74     //create insSqlstr and updSqlStr in advance;
    72     updSqlStr = updSqlStr + "where channelId = " + QString::number(channelId);
    75     updSqlStr = updSqlStr + "where channelId = " + QString::number(channelId);
    73     
    76     
    74     m_pIRDB->updRowImg(channelId, updSqlStr, pImgList)? ret = false:true;
    77     m_pIRDB->updRowImg(channelId, updSqlStr, pImgList, logoType)? ret = false:true;
    75     if(pImgList)
    78     if(pImgList)
    76     {
    79     {
    77         delete pImgList;
    80         delete pImgList;
    78         pImgList = NULL;
    81         pImgList = NULL;
    79     }
    82     }
    82 }
    85 }
    83 
    86 
    84 QList<QVariant*>* imgWrapper::getImg(const columnMap* const condAND,  
    87 QList<QVariant*>* imgWrapper::getImg(const columnMap* const condAND,  
    85                                    const columnMap* const condOR)
    88                                    const columnMap* const condOR)
    86 {
    89 {
    87     QString sltSqlStr = "select * from IRVIEW_channelinfo ";
    90     QString sltSqlStr = "select * from img ";
    88     QList<QVariant*>* pDataSet = NULL;
    91     QList<QVariant*>* pDataSet = NULL;
    89     
    92     
    90     if( (NULL != condAND)&&(NULL != condOR) )
    93     if( (NULL != condAND)&&(NULL != condOR) )
    91     {
    94     {
    92         return NULL;
    95         return NULL;