334 { |
334 { |
335 ++prmIdx;//the first SQLITE parameter index is 1 |
335 ++prmIdx;//the first SQLITE parameter index is 1 |
336 const TUint8* name8 = reinterpret_cast <const TUint8*> (sqlite3_bind_parameter_name(iStmtHandle, prmIdx)); |
336 const TUint8* name8 = reinterpret_cast <const TUint8*> (sqlite3_bind_parameter_name(iStmtHandle, prmIdx)); |
337 if(name8) |
337 if(name8) |
338 { |
338 { |
|
339 // coverity[size_error] |
339 HBufC* name = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8(name8, User::StringLength(name8))); |
340 HBufC* name = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8(name8, User::StringLength(name8))); |
340 TInt err = it.SetText(name->Des()); |
341 TInt err = it.SetText(name->Des()); |
341 delete name; |
342 delete name; |
342 __SQLLEAVE_IF_ERROR(err); |
343 __SQLLEAVE_IF_ERROR(err); |
343 } |
344 } |
675 TPtrC res; |
676 TPtrC res; |
676 TInt colType = sqlite3_column_type(iStmtHandle, aColIdx); |
677 TInt colType = sqlite3_column_type(iStmtHandle, aColIdx); |
677 if(colType == SQLITE_TEXT) |
678 if(colType == SQLITE_TEXT) |
678 { |
679 { |
679 TInt charLength = (TUint)sqlite3_column_bytes16(iStmtHandle, aColIdx) / sizeof(TUint16); |
680 TInt charLength = (TUint)sqlite3_column_bytes16(iStmtHandle, aColIdx) / sizeof(TUint16); |
680 //"charLength == 0" - this might be an indication of an "out of memory" problem, if the column text is in UTF8 format. |
681 // If charLength is 0 then this might be an indication of an "out of memory" problem, if the column text is in UTF8 format. |
681 //(sqlite3_column_bytes16() may allocate memory for UTF8->UTF16 conversion) |
682 // sqlite3_column_bytes16() may allocate memory for UTF8->UTF16 conversion. |
682 if(charLength == 0 && sqlite3_errcode(sqlite3_db_handle(iStmtHandle)) == SQLITE_NOMEM) |
683 if(charLength == 0 && sqlite3_errcode(sqlite3_db_handle(iStmtHandle)) == SQLITE_NOMEM) |
683 { |
684 { |
684 __SQLLEAVE(KErrNoMemory); |
685 __SQLLEAVE(KErrNoMemory); |
685 } |
686 } |
686 //sqlite3_column_bytes16() already allocated the needed memory if a UTF8->UTF16 conversion |
687 // sqlite3_column_bytes16() already allocated the needed memory if a UTF8->UTF16 conversion |
687 //had to be performed. The sqlite3_column_text16() on the next line is guaranteed to succeed. |
688 // had to be performed. The sqlite3_column_text16() on the next line is guaranteed to succeed. |
688 const TUint16* text = reinterpret_cast <const TUint16*> (sqlite3_column_text16(iStmtHandle, aColIdx)); |
689 const TUint16* text = reinterpret_cast <const TUint16*> (sqlite3_column_text16(iStmtHandle, aColIdx)); |
689 __ASSERT_DEBUG(text != NULL, __SQLPANIC(ESqlPanicInternalError)); |
690 __ASSERT_DEBUG(text != NULL, __SQLPANIC(ESqlPanicInternalError)); |
690 res.Set(text, charLength); |
691 res.Set(text, charLength); |
691 } |
692 } |
692 return res; |
693 return res; |