SQLEncoding for showinfo added
authorteknolog
Sat, 27 Feb 2010 18:30:56 +0000
changeset 21 420a1b4930da
parent 20 c92d8384952c
child 22 3243c9461520
SQLEncoding for showinfo added
application/sis/podcatcher_udeb.sis
application/sis/podcatcher_udeb_signed.sis
application/sis/podcatcher_urel.sis
application/sis/podcatcher_urel_signed.sis
engine/src/PodcastUtils.cpp
engine/src/ShowEngine.cpp
Binary file application/sis/podcatcher_udeb.sis has changed
Binary file application/sis/podcatcher_udeb_signed.sis has changed
Binary file application/sis/podcatcher_urel.sis has changed
Binary file application/sis/podcatcher_urel_signed.sis has changed
--- a/engine/src/PodcastUtils.cpp	Sat Feb 27 16:41:36 2010 +0000
+++ b/engine/src/PodcastUtils.cpp	Sat Feb 27 18:30:56 2010 +0000
@@ -68,6 +68,12 @@
 
 EXPORT_C void PodcastUtils::CleanHtmlL(TDes &str)
 {
+
+	if (str.Length() == 0)
+		{
+		return;
+		}
+	
 // miscellaneous cleanup
 	const TChar KLineBreak(CEditableText::ELineBreak); 
 	_LIT(KNewLine, "\n");
--- a/engine/src/ShowEngine.cpp	Sat Feb 27 16:41:36 2010 +0000
+++ b/engine/src/ShowEngine.cpp	Sat Feb 27 18:30:56 2010 +0000
@@ -737,14 +737,28 @@
 	{
 	DP2("CShowEngine::DBAddShow, title=%S, URL=%S", &aItem.Title(), &aItem.Url());
 
+	HBufC* titleBuf = HBufC::NewLC(KMaxLineLength);
+	TPtr titlePtr(titleBuf->Des());
+	titlePtr.Copy(aItem.Title());
+	PodcastUtils::SQLEncode(titlePtr);
+
+	HBufC* descBuf = HBufC::NewLC(KMaxLineLength);
+	TPtr descPtr(descBuf->Des());
+	descPtr.Copy(aItem.Description());
+	PodcastUtils::SQLEncode(descPtr);
+	
 	_LIT(KSqlStatement, "insert into shows (url, title, description, filename, position, playtime, playstate, downloadstate, feeduid, uid, showsize, trackno, pubdate, showtype)"
 			" values (\"%S\",\"%S\", \"%S\", \"%S\", \"%Lu\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%u\", \"%Lu\", \"%d\")");
-	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &aItem.Title(), &aItem.Description(),
+	
+	iSqlBuffer.Format(KSqlStatement, &aItem.Url(), &titlePtr, &descPtr,
 			&aItem.FileName(), aItem.Position().Int64(), aItem.PlayTime(),
 			aItem.PlayState(), aItem.DownloadState(), aItem.FeedUid(),
 			aItem.Uid(), aItem.ShowSize(), aItem.TrackNo(),
 			aItem.PubDate().Int64(), aItem.ShowType());
 
+	CleanupStack::PopAndDestroy(descBuf);
+	CleanupStack::PopAndDestroy(titleBuf);
+
 	sqlite3_stmt *st;
 
 	int rc = sqlite3_prepare16_v2(&iDB, (const void*) iSqlBuffer.PtrZ(), -1,