00001 00014 #ifndef _cMySQL_h 00015 #define _cMySQL_h 00016 00017 #include "TypesDef.h" // Need constants. 00018 00019 #if !wxLINUX 00020 #include <windows.h> 00021 #include <MySQL\mysql.h> 00022 #else 00023 #include <mysql.h> 00024 #endif 00025 00026 00027 #include "cSqlBaseIf.h" 00028 00029 #include "cFileSqlString.h" 00030 #include "cMovieSqlString.h" 00031 #include "cSoftwareSqlString.h" 00032 #include "cMusicSqlString.h" 00033 00034 #include "cFile.h" 00035 #include "cMovie.h" 00036 #include "cMusic.h" 00037 #include "cSoftware.h" 00038 00039 class cMySQL: public cSqlBaseIf 00040 { 00041 public: 00042 cMySQL(void); 00043 ~cMySQL(void); 00044 00046 Bool Connect(void); 00047 00049 void Close(void); 00050 00052 Int ErrorNum(void); 00053 00055 list<string> GetDatabaseList(void); 00056 00058 Bool CreateDatabase(string sDbName); 00059 00061 Bool DeleteDatabase(string sDbName); 00062 00064 Bool SelectDatabase(string sDbName); 00065 00067 void CreateTables(void); 00068 00069 00071 list< list<string> > GetFileList(void); 00072 00074 list< list<string> > GetMovieList(void); 00075 00077 list< list<string> > GetSoftwareList(void); 00078 00080 list< list<string> > GetMusicList(void); 00081 00083 list<string> GetFileRowResult(const string sMd4); 00084 00086 list<string> GetMovieRowResult(const string sMd4); 00087 00089 list<string> GetSoftwareRowResult(const string sMd4); 00090 00092 list<string> GetMusicRowResult(const string sMd4); 00093 00094 00096 Bool InsertNewEntry2File(cFile* File); 00097 00099 Bool InsertNewEntry2Movie(cMovie* Movie); 00100 00102 Bool InsertNewEntry2Music(cMusic* Music); 00103 00105 Bool InsertNewEntry2Software(cSoftware* Software); 00106 00107 00108 00110 Bool IsMd4Found(const string sMd4); 00111 00113 const string GetCategory(const string sMd4); 00114 00115 00117 Bool UpdateFile(cFile* pFile); 00118 00120 Bool UpdateMovie(cMovie* pMovie); 00121 00123 Bool UpdateSoftware(cSoftware* pSoftware); 00124 00126 Bool UpdateMusic(cMusic* pMusic); 00127 00128 00130 Bool DeleteFromFile(const string sMd4); 00131 00133 Bool DeleteFromMovie(const string sMd4); 00134 00136 Bool DeleteFromSoftware(const string sMd4); 00137 00139 Bool DeleteFromMusic(const string sMd4); 00140 00141 protected: 00142 00143 private: 00144 static MYSQL SQLConnection; // pointer to connection handler. 00145 00146 MYSQL_RES *SQLResult; 00147 MYSQL_ROW SQLRow; 00148 00150 Bool Init(void); // Initialize the connection. 00151 00153 Bool Query(string sQuery); 00154 00156 list< list<string> > GetQueryTableResult(void); 00157 00162 list<string> GetQueryRowResult(void); 00163 00168 list<string> GetQueryColResult(void); 00169 00171 Bool CompareList(const list<string> lFirst, const list<string> lSecond); 00172 Bool CompareTable(const string sTableName, list<string> lFixColNames); 00173 00174 list< list<string> > GetGeneralInfoListOf(string sSqlCategory); 00175 00176 cFileSqlString FileSqlString; 00177 cMovieSqlString MovieSqlString; 00178 cSoftwareSqlString SoftwareSqlString; 00179 cMusicSqlString MusicSqlString; 00180 00181 00182 }; 00183 00184 #endif // _cMySQL_h 00185