/*
 * cmtreader.c: a class that reads comments from database
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */
#include "cmtreader.h"
#include "tools.h"

static char sqlComment[] = "SELECT commentary FROM vdr_Commentary WHERE media=%d";

cCommentReader::cCommentReader(int media)
{_ 
  asprintf(&sql, sqlComment, media);
  Init();
}

cCommentReader::~cCommentReader() 
{_
  SLDEBUG("# destructor of cCommentReader");
  free(sql);
}

cMenuCommentItem * cCommentReader::Read()
{_
  cMenuCommentItem * pGI = new cMenuCommentItem();
  cDataInfo	DatInf[] = {
	  { cDataInfo::TEXT, (char *)&(pGI->comment) - (char *)pGI },
	  { cDataInfo::UNKNOWN, 0 }
     };
  return Super::Read(pGI, DatInf);	
}
