Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61 lines (50 sloc)
1.13 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wxWindows includes | |
#include <wx/string.h> | |
#include <wx/arrstr.h> | |
#include <wx/dynarray.h> | |
// Statsgen includes | |
#include "SpeechData.h" | |
#include "GlobalStatistics.h" | |
SpeechData::SpeechData() | |
{ | |
} | |
SpeechData::~SpeechData() | |
{ | |
} | |
wxString SpeechData::SQLTableName() | |
{ | |
wxString retVal="speechdata"; | |
return (retVal); | |
} | |
wxString SpeechData::SQLCreateTable() | |
{ | |
wxString SQL; | |
SQL.Printf("create table %s" | |
"(" | |
"roundindex integer," | |
"speechidx integer," | |
"playerindex integer," | |
"%s" | |
")", | |
SQLTableName().GetData(), | |
StatsgenDatabase::StringFieldDefinition("speech","speech",FIELD_WIDTH_SPEECH).GetData()); | |
return SQL; | |
} | |
bool SpeechData::WriteToDatabase(int roundIndex,int itemIndex) | |
{ | |
wxString SQL; | |
bool retVal=true; | |
Player player; | |
player=globalStatistics.playerList.Item(playerIndex); | |
SQL.Printf("insert into %s" | |
"(roundindex,speechidx,playerindex,speech)" | |
"values" | |
"('%d','%d','%d','%s')", | |
SQLTableName().GetData(), | |
roundIndex, | |
itemIndex, | |
player.actualPlayerIndex, | |
StatsgenDatabase::SafeForInsert(speech).GetData()); | |
globalStatistics.statsgenDatabase.SimpleExecute(SQL); | |
return retVal; | |
} |