735 |
735 |
736 TBool CShowEngine::DBAddShow(const CShowInfo& aItem) |
736 TBool CShowEngine::DBAddShow(const CShowInfo& aItem) |
737 { |
737 { |
738 DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url()); |
738 DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url()); |
739 |
739 |
|
740 HBufC* titleBuf = HBufC::NewLC(KMaxLineLength); |
|
741 TPtr titlePtr(titleBuf->Des()); |
|
742 titlePtr.Copy(aItem.Title()); |
|
743 PodcastUtils::SQLEncode(titlePtr); |
|
744 |
|
745 HBufC* descBuf = HBufC::NewLC(KMaxLineLength); |
|
746 TPtr descPtr(descBuf->Des()); |
|
747 descPtr.Copy(aItem.Description()); |
|
748 PodcastUtils::SQLEncode(descPtr); |
|
749 |
740 _LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype)" |
750 _LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype)" |
741 " values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\")"); |
751 " values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\")"); |
742 iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &aItem.Title(), &aItem.Description(), |
752 |
|
753 iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr, |
743 &aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(), |
754 &aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(), |
744 aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(), |
755 aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(), |
745 aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(), |
756 aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(), |
746 aItem.PubDate().Int64(), aItem.ShowType()); |
757 aItem.PubDate().Int64(), aItem.ShowType()); |
|
758 |
|
759 CleanupStack::PopAndDestroy(descBuf); |
|
760 CleanupStack::PopAndDestroy(titleBuf); |
747 |
761 |
748 sqlite3_stmt *st; |
762 sqlite3_stmt *st; |
749 |
763 |
750 int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
764 int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1, |
751 &st, (const void**) NULL); |
765 &st, (const void**) NULL); |