qtinternetradio/irdb/src/irdbwrapper.cpp
changeset 17 38bbf2dcd608
parent 16 5723da102db1
equal deleted inserted replaced
16:5723da102db1 17:38bbf2dcd608
   130 void IRDBWrapper::combinePutStr(const columnMap* const RowData,
   130 void IRDBWrapper::combinePutStr(const columnMap* const RowData,
   131                                 const QString* pArryColName,
   131                                 const QString* pArryColName,
   132                                 QString& insSqlStr, 
   132                                 QString& insSqlStr, 
   133                                 QString& updSqlStr,
   133                                 QString& updSqlStr,
   134                                 const logoMap* const logoData,
   134                                 const logoMap* const logoData,
   135                                 QList<QByteArray>* logoArrayList)
   135                                 QList<QByteArray>* logoArrayList,
       
   136                                 int* logoType)
   136 {
   137 {
   137     bool bContinue = false;
   138     bool bContinue = false;
   138     columnMap::const_iterator it;
   139     columnMap::const_iterator it;
   139     logoMap::const_iterator itLogoMap;
   140     logoMap::const_iterator itLogoMap;
   140     QString escStr;
   141     QString escStr;
   141     insSqlStr += "(";
   142     insSqlStr += "(";
   142     
   143     
       
   144     
   143     if(NULL != RowData)
   145     if(NULL != RowData)
   144     {
   146     {
   145         bContinue = true;
   147         bContinue = true;
   146         it = RowData->begin();
   148         it = RowData->begin();
   147         while(it != RowData->end())
   149         while(it != RowData->end())
   157         }
   159         }
   158     }
   160     }
   159     
   161     
   160     if(NULL != logoData)
   162     if(NULL != logoData)
   161     {
   163     {
       
   164         if(logoType)
       
   165         {
       
   166             *logoType = 0x00; //
       
   167         }
       
   168         else
       
   169         {
       
   170             return;
       
   171         }
   162         itLogoMap = logoData->begin();
   172         itLogoMap = logoData->begin();
   163         while(itLogoMap != logoData->end())
   173         while(itLogoMap != logoData->end())
   164         {
   174         {
   165             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   175             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   166             {
   176             {
   167                      insSqlStr += ",";  
   177                      insSqlStr += ",";  
   168             }
   178             }
   169  
   179             if(bLogo ==itLogoMap.key())
       
   180             {
       
   181                 *logoType += IRDB_BIG_LOGO;
       
   182             }
       
   183             if(sLogo ==itLogoMap.key())
       
   184             {
       
   185                 *logoType += IRDB_SMALL_LOGO;
       
   186             }
       
   187              
   170             insSqlStr += colNameLogo[itLogoMap.key()];
   188             insSqlStr += colNameLogo[itLogoMap.key()];
   171             ++itLogoMap;        
   189             ++itLogoMap;        
   172         }
   190         }
   173     }
   191     }
   174     
   192     
   193     }    
   211     }    
   194 
   212 
   195 
   213 
   196     if(NULL != logoData)
   214     if(NULL != logoData)
   197     {
   215     {
       
   216       
   198         itLogoMap = logoData->begin();
   217         itLogoMap = logoData->begin();
   199         while(itLogoMap != logoData->end())
   218         while(itLogoMap != logoData->end())
   200         {
   219         {
   201             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   220             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   202             {
   221             {
   203                  insSqlStr += ",";  
   222                  insSqlStr += ",";  
   204             }
   223             }
       
   224             
   205             insSqlStr = insSqlStr + " :"+colNameLogo[itLogoMap.key()];
   225             insSqlStr = insSqlStr + " :"+colNameLogo[itLogoMap.key()];
   206             *logoArrayList<<itLogoMap.value();
   226             *logoArrayList<<itLogoMap.value();
   207 
   227 
   208             ++itLogoMap;        
   228             ++itLogoMap;        
   209         }
   229         }
   237         }
   257         }
   238     }
   258     }
   239     
   259     
   240     if(NULL != logoData)
   260     if(NULL != logoData)
   241     {
   261     {
       
   262 
   242         itLogoMap = logoData->begin();
   263         itLogoMap = logoData->begin();
   243         while(itLogoMap != logoData->end())
   264         while(itLogoMap != logoData->end())
   244         {
   265         {
   245             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   266             if( (false != bContinue)||(itLogoMap != logoData->begin()) )
   246             {
   267             {
   247                  updSqlStr += ",";  
   268                  updSqlStr += ",";  
   248             }
   269             }
   249 
   270 
   250             updSqlStr = updSqlStr + colNameLogo[itLogoMap.key()] + "=:"+colNameLogo[itLogoMap.key()];
   271             updSqlStr = updSqlStr + colNameLogo[itLogoMap.key()] + "=:"+colNameLogo[itLogoMap.key()] + " ";
   251             ++itLogoMap;        
   272             ++itLogoMap;        
   252         }
   273         }
   253     }    
   274     }    
   254     
   275     
   255     return;
   276     return;
   262                                  const QString* pArryColName,
   283                                  const QString* pArryColName,
   263                                  QString& condSqlStr)
   284                                  QString& condSqlStr)
   264 {
   285 {
   265     bool bDone = false;
   286     bool bDone = false;
   266     columnMap::const_iterator it;
   287     columnMap::const_iterator it;
       
   288     QString escStr;
   267     
   289     
   268     if(NULL != condAND)
   290     if(NULL != condAND)
   269     {
   291     {
   270         if( true != condAND->empty() )
   292         if( true != condAND->empty() )
   271         {
   293         {
   277             {
   299             {
   278                 if(it != condAND->begin())
   300                 if(it != condAND->begin())
   279                 {
   301                 {
   280                     condSqlStr += " AND ";
   302                     condSqlStr += " AND ";
   281                 }
   303                 }
   282                 
   304                 escStr = it.value();
   283                 condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + it.value()+ "'" ;
   305                 escStr.replace('\'', "\'\'");
       
   306                 condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + escStr + "'" ;
   284                     
   307                     
   285                 ++it;
   308                 ++it;
   286             }
   309             }
   287             
   310             
   288             bDone = true;               
   311             bDone = true;               
   305             {
   328             {
   306                 if(it != condOR->begin())
   329                 if(it != condOR->begin())
   307                 {
   330                 {
   308                     condSqlStr += " OR ";
   331                     condSqlStr += " OR ";
   309                 }
   332                 }
   310                 
   333                 escStr = it.value();
       
   334                 escStr.replace('\'', "\'\'");
   311                 condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + it.value()+ "'" ;
   335                 condSqlStr = condSqlStr + pArryColName[it.key()] + "=" + "'" + it.value()+ "'" ;
   312                 ++it;
   336                 ++it;
   313              }               
   337              }               
   314         }       
   338         }       
   315     }
   339     }