Project

General

Profile

Bug #177 » ticket_177.patch

dandar3, 11/09/2011 07:13 PM

View differences:

lib/libGoAhead/XBMChttp.cpp (working copy)
#include "FileSystem/CDDADirectory.h"
#include "FileSystem/SpecialProtocol.h"
#include "VideoDatabase.h"
#include "ProgramDatabase.h"
#include "GUIButtonControl.h"
#include "utils/GUIInfoManager.h"
#include "Picture.h"
......
return true;
}
int CXbmcHttp::xbmcQueryProgramDataBase(int numParas, CStdString paras[])
{
if (numParas==0)
return SetResponse(openTag+"Error:Missing Parameter");
else
{
CProgramDatabase programdatabase;
if (programdatabase.Open())
{
CStdString result;
if (programdatabase.GetArbitraryQuery(paras[0], openRecordSet, closeRecordSet, openRecord, closeRecord, openField, closeField, result))
return SetResponse(result);
else
return SetResponse(openTag+"Error:"+result);
programdatabase.Close();
}
else
return SetResponse(openTag+"Error:Could not open database");
}
return true;
}
int CXbmcHttp::xbmcExecVideoDataBase(int numParas, CStdString paras[])
{
if (numParas==0)
......
else if (command == "setresponseformat") retVal = xbmcSetResponseFormat(numParas, paras);
else if (command == "querymusicdatabase") retVal = xbmcQueryMusicDataBase(numParas, paras);
else if (command == "queryvideodatabase") retVal = xbmcQueryVideoDataBase(numParas, paras);
else if (command == "queryprogramdatabase") retVal = xbmcQueryProgramDataBase(numParas, paras);
else if (command == "execmusicdatabase") retVal = xbmcExecMusicDataBase(numParas, paras);
else if (command == "execvideodatabase") retVal = xbmcExecVideoDataBase(numParas, paras);
else if (command == "spindownharddisk") retVal = xbmcSpinDownHardDisk(numParas, paras);
lib/libGoAhead/XBMChttp.h (working copy)
int xbmcChooseAlbum(int numParas, CStdString paras[]);
int xbmcQueryMusicDataBase(int numParas, CStdString paras[]);
int xbmcQueryVideoDataBase(int numParas, CStdString paras[]);
int xbmcQueryProgramDataBase(int numParas, CStdString paras[]);
int xbmcExecMusicDataBase(int numParas, CStdString paras[]);
int xbmcExecVideoDataBase(int numParas, CStdString paras[]);
int xbmcDownloadInternetFile(int numParas, CStdString paras[]);
ProgramDatabase.cpp (working copy)
return false;
}
bool CProgramDatabase::GetArbitraryQuery(const CStdString& strQuery, const CStdString& strOpenRecordSet, const CStdString& strCloseRecordSet,
const CStdString& strOpenRecord, const CStdString& strCloseRecord, const CStdString& strOpenField,
const CStdString& strCloseField, CStdString& strResult)
{
try
{
strResult = "";
if (NULL == m_pDB.get()) return false;
if (NULL == m_pDS.get()) return false;
CStdString strSQL=strQuery;
if (!m_pDS->query(strSQL.c_str()))
{
strResult = m_pDB->getErrorMsg();
return false;
}
strResult=strOpenRecordSet;
while (!m_pDS->eof())
{
strResult += strOpenRecord;
for (int i=0; i<m_pDS->fieldCount(); i++)
{
strResult += strOpenField + CStdString(m_pDS->fv(i).get_asString()) + strCloseField;
}
strResult += strCloseRecord;
m_pDS->next();
}
strResult += strCloseRecordSet;
m_pDS->close();
return true;
}
catch (...)
{
CLog::Log(LOGERROR, "%s failed", __FUNCTION__);
}
try
{
if (NULL == m_pDB.get()) return false;
strResult = m_pDB->getErrorMsg();
}
catch (...)
{
}
return false;
}
ProgramDatabase.h (working copy)
int GetProgramInfo(CFileItem *item);
bool AddProgramInfo(CFileItem *item, unsigned int titleID);
bool GetArbitraryQuery(const CStdString& strQuery, const CStdString& strOpenRecordSet, const CStdString& strCloseRecordSet,
const CStdString& strOpenRecord, const CStdString& strCloseRecord, const CStdString& strOpenField, const CStdString& strCloseField, CStdString& strResult);
protected:
virtual bool CreateTables();
virtual bool UpdateOldVersion(int version);
(1-1/2)