mpserviceplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp
changeset 47 4cc1412daed0
parent 22 ecf06a08d4d9
equal deleted inserted replaced
45:612c4815aebe 47:4cc1412daed0
   417     if (recordset.Next() != KSqlAtRow)
   417     if (recordset.Next() != KSqlAtRow)
   418         {
   418         {
   419         User::Leave(KErrNotFound);
   419         User::Leave(KErrNotFound);
   420         }
   420         }
   421 
   421 
   422     TUint32 value(recordset.ColumnInt64(KMPXTableDefaultIndex));
   422     TInt64 value( recordset.ColumnInt64( KMPXTableDefaultIndex ) );
   423     CleanupStack::PopAndDestroy(&recordset);
   423     CleanupStack::PopAndDestroy(&recordset);
   424 
   424 
   425     return value;
   425     return value < 0 ? 0: I64LOW( value );
   426     }
   426     }
   427 
   427 
   428 // ----------------------------------------------------------------------------
   428 // ----------------------------------------------------------------------------
   429 // CMPXDbTable::ExecuteIntQueryL
   429 // CMPXDbTable::ExecuteIntQueryL
   430 // ----------------------------------------------------------------------------
   430 // ----------------------------------------------------------------------------
   454     {
   454     {
   455     MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
   455     MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
   456 
   456 
   457     // replace single quotes
   457     // replace single quotes
   458     // reserve double the value length for single quote duplicates
   458     // reserve double the value length for single quote duplicates
       
   459     // coverity[incorrect_multiplication]
       
   460     // coverity[buffer_alloc]
   459     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   461     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   460     TPtr value1Ptr(value1->Des());
   462     TPtr value1Ptr(value1->Des());
   461     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   463     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   462 
   464 
   463     // construct the query
   465     // construct the query
   482     const TDesC& aValue)
   484     const TDesC& aValue)
   483     {
   485     {
   484     MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
   486     MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
   485 
   487 
   486     // replace single quotes
   488     // replace single quotes
       
   489     // coverity[incorrect_multiplication]
       
   490     // coverity[buffer_alloc]
   487     HBufC* value = HBufC::NewLC(aValue.Length() * 2);
   491     HBufC* value = HBufC::NewLC(aValue.Length() * 2);
   488     TPtr valuePtr(value->Des());
   492     TPtr valuePtr(value->Des());
   489     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
   493     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
   490 
   494 
   491     // construct the query
   495     // construct the query
   638     {
   642     {
   639     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   643     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   640 
   644 
   641     // replace single quotes
   645     // replace single quotes
   642     // reserve double the value length for single quote duplicates
   646     // reserve double the value length for single quote duplicates
       
   647     // coverity[incorrect_multiplication]
       
   648     // coverity[buffer_alloc]
   643     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   649     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   644     TPtr value1Ptr(value1->Des());
   650     TPtr value1Ptr(value1->Des());
   645     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   651     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   646 
   652 
   647     // construct the query
   653     // construct the query
   668     {
   674     {
   669     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   675     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   670 
   676 
   671     // replace single quotes
   677     // replace single quotes
   672     // reserve double the value length for single quote duplicates
   678     // reserve double the value length for single quote duplicates
       
   679     // coverity[incorrect_multiplication]
       
   680     // coverity[buffer_alloc]
   673     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   681     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   674     TPtr value1Ptr(value1->Des());
   682     TPtr value1Ptr(value1->Des());
   675     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   683     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   676 
   684 
       
   685     // coverity[incorrect_multiplication]
       
   686     // coverity[buffer_alloc]
   677     HBufC* value2 = HBufC::NewLC(aValue2.Length() * 2);
   687     HBufC* value2 = HBufC::NewLC(aValue2.Length() * 2);
   678     TPtr value2Ptr(value2->Des());
   688     TPtr value2Ptr(value2->Des());
   679     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue2, value2Ptr);
   689     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue2, value2Ptr);
   680 
   690 
   681     // construct the query
   691     // construct the query
   702     {
   712     {
   703     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   713     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   704 
   714 
   705     // replace single quotes
   715     // replace single quotes
   706     // reserve double the value length for single quote duplicates
   716     // reserve double the value length for single quote duplicates
       
   717     // coverity[incorrect_multiplication]
       
   718     // coverity[buffer_alloc]
   707     HBufC* value = HBufC::NewLC(aValue.Length() * 2);
   719     HBufC* value = HBufC::NewLC(aValue.Length() * 2);
   708     TPtr valuePtr(value->Des());
   720     TPtr valuePtr(value->Des());
   709     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
   721     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
   710 
   722 
   711     // construct the query
   723     // construct the query
   734     {
   746     {
   735     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   747     MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
   736 
   748 
   737     // replace single quotes
   749     // replace single quotes
   738     // reserve double the value length for single quote duplicates
   750     // reserve double the value length for single quote duplicates
       
   751     // coverity[incorrect_multiplication]
       
   752     // coverity[buffer_alloc]
   739     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   753     HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
   740     TPtr value1Ptr(value1->Des());
   754     TPtr value1Ptr(value1->Des());
   741     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   755     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
   742 
   756 
   743     // replace single quotes
   757     // replace single quotes
   744     // reserve double the value length for single quote duplicates
   758     // reserve double the value length for single quote duplicates
       
   759     // coverity[incorrect_multiplication]
       
   760     // coverity[buffer_alloc]
   745     HBufC* value3 = HBufC::NewLC(aValue3.Length() * 2);
   761     HBufC* value3 = HBufC::NewLC(aValue3.Length() * 2);
   746     TPtr value3Ptr(value3->Des());
   762     TPtr value3Ptr(value3->Des());
   747     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue3, value3Ptr);
   763     MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue3, value3Ptr);
   748 
   764 
   749     // construct the query
   765     // construct the query