comment the sqlite-log
This commit is contained in:
+219
-219
@@ -63,7 +63,7 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
|
||||
myLogDir = new QDir(QString::fromUtf8(myConfig->readConfigString("LogDir").c_str()));
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
myHtmlLogFile = new QFile(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".html");
|
||||
mySqliteLogDb = new QSqlDatabase;
|
||||
// mySqliteLogDb = new QSqlDatabase;
|
||||
|
||||
//Logo-Pixmap extrahieren
|
||||
QPixmap logoChipPixmapFile(":/gfx/logoChip3D.png");
|
||||
@@ -84,84 +84,84 @@ Log::Log(gameTableImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), my
|
||||
myHtmlLogFile->close();
|
||||
|
||||
int i;
|
||||
// lege sqlite-Datenbank
|
||||
*mySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
|
||||
mySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".pdb");
|
||||
if(mySqliteLogDb->open()) {
|
||||
|
||||
QSqlQuery query(*mySqliteLogDb);
|
||||
QString sql;
|
||||
|
||||
// Session-Tabelle
|
||||
sql = "CREATE TABLE Session (";
|
||||
sql += "PokerTH_Version TEXT,";
|
||||
sql += "Date TEXT,";
|
||||
sql += "Time TEXT,";
|
||||
sql += "PRIMARY KEY(Date,Time))";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
sql = "INSERT INTO Session (PokerTH_Version,Date,Time) VALUES (";
|
||||
sql += "'"+QString("%1").arg(POKERTH_BETA_RELEASE_STRING)+"',";
|
||||
sql += "'"+currentTime.toString("yyyy-MM-dd")+"',";
|
||||
sql += "'"+currentTime.toString("hh:mm:ss")+"')";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Game-Tabelle
|
||||
sql = "CREATE TABLE Game (";
|
||||
sql += "GameID INTEGER NOT NULL PRIMARY KEY,";
|
||||
sql += "Startmoney INTEGER NOT NULL,";
|
||||
sql += "StartSb INTEGER NOT NULL,";
|
||||
sql += "DealerPos INTEGER NOT NULL";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += ",Seat_" + QString("%1").arg(i);
|
||||
}
|
||||
sql += ",Winner_Seat INTEGER)";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Hand-Tabelle
|
||||
sql = "CREATE TABLE Hand (";
|
||||
sql += "HandID INTEGER NOT NULL,";
|
||||
sql += "GameID INTEGER NOT NULL,";
|
||||
sql += "Sb_Amount INTEGER,";
|
||||
sql += "Sb_Seat INTEGER,";
|
||||
sql += "Bb_Amount INTEGER,";
|
||||
sql += "Bb_Seat INTEGER,";
|
||||
sql += "Dealer_Seat INTEGER,";
|
||||
for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Cash INTEGER,";
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Card_1 INTEGER,";
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Card_2 INTEGER,";
|
||||
sql += "Seat_" + QString("%1").arg(i) + "_Hand TEXT,";
|
||||
}
|
||||
for(i=1; i<=5; i++) {
|
||||
sql += "BoardCard_" + QString("%1").arg(i) + " INTEGER,";
|
||||
}
|
||||
sql += "PRIMARY KEY(HandID,GameID))";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
// Action-Tabelle
|
||||
sql = "CREATE TABLE Action (";
|
||||
sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT,";
|
||||
sql += "HandID INTEGER NOT NULL,";
|
||||
sql += "GameID INTEGER NOT NULL,";
|
||||
sql += "BeRo INTEGER NOT NULL,";
|
||||
sql += "Player INTEGER NOT NULL,";
|
||||
sql += "Action INTEGER NOT NULL,";
|
||||
sql += "Amount INTEGER)";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
} else {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
// // lege sqlite-Datenbank
|
||||
// *mySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
|
||||
// mySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".pdb");
|
||||
// if(mySqliteLogDb->open()) {
|
||||
//
|
||||
// QSqlQuery query(*mySqliteLogDb);
|
||||
// QString sql;
|
||||
//
|
||||
// // Session-Tabelle
|
||||
// sql = "CREATE TABLE Session (";
|
||||
// sql += "PokerTH_Version TEXT,";
|
||||
// sql += "Date TEXT,";
|
||||
// sql += "Time TEXT,";
|
||||
// sql += "PRIMARY KEY(Date,Time))";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
// sql = "INSERT INTO Session (PokerTH_Version,Date,Time) VALUES (";
|
||||
// sql += "'"+QString("%1").arg(POKERTH_BETA_RELEASE_STRING)+"',";
|
||||
// sql += "'"+currentTime.toString("yyyy-MM-dd")+"',";
|
||||
// sql += "'"+currentTime.toString("hh:mm:ss")+"')";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// // Game-Tabelle
|
||||
// sql = "CREATE TABLE Game (";
|
||||
// sql += "GameID INTEGER NOT NULL PRIMARY KEY,";
|
||||
// sql += "Startmoney INTEGER NOT NULL,";
|
||||
// sql += "StartSb INTEGER NOT NULL,";
|
||||
// sql += "DealerPos INTEGER NOT NULL";
|
||||
// for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// sql += ",Seat_" + QString("%1").arg(i);
|
||||
// }
|
||||
// sql += ",Winner_Seat INTEGER)";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// // Hand-Tabelle
|
||||
// sql = "CREATE TABLE Hand (";
|
||||
// sql += "HandID INTEGER NOT NULL,";
|
||||
// sql += "GameID INTEGER NOT NULL,";
|
||||
// sql += "Sb_Amount INTEGER,";
|
||||
// sql += "Sb_Seat INTEGER,";
|
||||
// sql += "Bb_Amount INTEGER,";
|
||||
// sql += "Bb_Seat INTEGER,";
|
||||
// sql += "Dealer_Seat INTEGER,";
|
||||
// for(i=1; i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// sql += "Seat_" + QString("%1").arg(i) + "_Cash INTEGER,";
|
||||
// sql += "Seat_" + QString("%1").arg(i) + "_Card_1 INTEGER,";
|
||||
// sql += "Seat_" + QString("%1").arg(i) + "_Card_2 INTEGER,";
|
||||
// sql += "Seat_" + QString("%1").arg(i) + "_Hand TEXT,";
|
||||
// }
|
||||
// for(i=1; i<=5; i++) {
|
||||
// sql += "BoardCard_" + QString("%1").arg(i) + " INTEGER,";
|
||||
// }
|
||||
// sql += "PRIMARY KEY(HandID,GameID))";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// // Action-Tabelle
|
||||
// sql = "CREATE TABLE Action (";
|
||||
// sql += "ActionID INTEGER PRIMARY KEY AUTOINCREMENT,";
|
||||
// sql += "HandID INTEGER NOT NULL,";
|
||||
// sql += "GameID INTEGER NOT NULL,";
|
||||
// sql += "BeRo INTEGER NOT NULL,";
|
||||
// sql += "Player INTEGER NOT NULL,";
|
||||
// sql += "Action INTEGER NOT NULL,";
|
||||
// sql += "Amount INTEGER)";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
|
||||
//Zu alte Dateien löschen!!!
|
||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||
@@ -201,16 +201,16 @@ Log::~Log()
|
||||
{
|
||||
delete myLogDir;
|
||||
delete myHtmlLogFile;
|
||||
delete mySqliteLogDb;
|
||||
// delete mySqliteLogDb;
|
||||
|
||||
}
|
||||
|
||||
void Log::closeLogDbAtExit()
|
||||
{
|
||||
// Datenbank schließen
|
||||
mySqliteLogDb->close();
|
||||
delete mySqliteLogDb;
|
||||
mySqliteLogDb = NULL;
|
||||
// mySqliteLogDb->close();
|
||||
// delete mySqliteLogDb;
|
||||
// mySqliteLogDb = NULL;
|
||||
}
|
||||
|
||||
void Log::logPlayerActionMsg(QString msg, int playerID, int action, int setValue) {
|
||||
@@ -245,25 +245,25 @@ void Log::logPlayerActionMsg(QString msg, int playerID, int action, int setValue
|
||||
logFileStreamString = "";
|
||||
}
|
||||
|
||||
if(mySqliteLogDb->isOpen()) {
|
||||
|
||||
QSqlQuery query(*mySqliteLogDb);
|
||||
QString sql;
|
||||
|
||||
sql = "INSERT INTO Action (HandID,GameID,BeRo,Player,Action,Amount) VALUES (";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10);
|
||||
sql += "," + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
sql += "," + QString::number(myW->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),10);
|
||||
sql += "," + QString::number(playerID,10);
|
||||
sql += "," + QString::number(action,10);
|
||||
sql += "," + QString::number(setValue,10);
|
||||
sql += ")";
|
||||
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
}
|
||||
// if(mySqliteLogDb->isOpen()) {
|
||||
//
|
||||
// QSqlQuery query(*mySqliteLogDb);
|
||||
// QString sql;
|
||||
//
|
||||
// sql = "INSERT INTO Action (HandID,GameID,BeRo,Player,Action,Amount) VALUES (";
|
||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10);
|
||||
// sql += "," + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
// sql += "," + QString::number(myW->getSession()->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->getMyBeRoID(),10);
|
||||
// sql += "," + QString::number(playerID,10);
|
||||
// sql += "," + QString::number(action,10);
|
||||
// sql += "," + QString::number(setValue,10);
|
||||
// sql += ")";
|
||||
//
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -283,76 +283,76 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||
logFileStreamString += "<table><tr><td width=\"600\" align=\"center\"><hr noshade size=\"3\"><b>Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"</b></td><td></td></tr></table>";
|
||||
logFileStreamString += "BLIND LEVEL: $"+QString::number(currentHand->getSmallBlind())+" / $"+QString::number(currentHand->getSmallBlind()*2)+"</br>";
|
||||
|
||||
if(!mySqliteLogDb->open()) {
|
||||
QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
// if(!mySqliteLogDb->open()) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
|
||||
|
||||
if(mySqliteLogDb->isOpen()) {
|
||||
|
||||
QSqlQuery query(*mySqliteLogDb);
|
||||
QString sql;
|
||||
|
||||
// bei Beginn eines Games
|
||||
if(handID == 1) {
|
||||
sql = "INSERT INTO Game (GameID,Startmoney,StartSb,DealerPos";
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10);
|
||||
}
|
||||
// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// sql += ",Seat_" + QString::number(i,10);
|
||||
//
|
||||
// if(mySqliteLogDb->isOpen()) {
|
||||
//
|
||||
// QSqlQuery query(*mySqliteLogDb);
|
||||
// QString sql;
|
||||
//
|
||||
// // bei Beginn eines Games
|
||||
// if(handID == 1) {
|
||||
// sql = "INSERT INTO Game (GameID,Startmoney,StartSb,DealerPos";
|
||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10);
|
||||
// }
|
||||
sql += ") VALUES (";
|
||||
sql += QString::number(gameID,10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getStartCash(),10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getStartSmallBlind(),10) + ",";
|
||||
sql += QString::number(myW->getSession()->getCurrentGame()->getDealerPosition(),10);
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
||||
}
|
||||
// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
// if((*it_c)->getMyActiveStatus()) {
|
||||
// sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
||||
// } else {
|
||||
// sql += ",NULL";
|
||||
// }
|
||||
//// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//// sql += ",Seat_" + QString::number(i,10);
|
||||
//// }
|
||||
// sql += ") VALUES (";
|
||||
// sql += QString::number(gameID,10) + ",";
|
||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getStartCash(),10) + ",";
|
||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getStartSmallBlind(),10) + ",";
|
||||
// sql += QString::number(myW->getSession()->getCurrentGame()->getDealerPosition(),10);
|
||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
||||
// }
|
||||
sql += ")";
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
}
|
||||
|
||||
sql = "INSERT INTO Hand (HandID,GameID,Sb_Amount,Bb_Amount";
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10) + "_Cash";
|
||||
}
|
||||
// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
// sql += ",Seat_" + QString("%1").arg(i) + "_Cash";
|
||||
// }
|
||||
sql += ") VALUES (";
|
||||
sql += QString::number(handID,10);
|
||||
sql += "," + QString::number(gameID,10);
|
||||
sql += "," + QString::number(currentHand->getSmallBlind(),10);
|
||||
sql += "," + QString::number(currentHand->getSmallBlind()*2,10);
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
||||
}
|
||||
// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
// if((*it_c)->getMyActiveStatus()) {
|
||||
// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
||||
// } else {
|
||||
// sql += ",NULL";
|
||||
//// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
//// if((*it_c)->getMyActiveStatus()) {
|
||||
//// sql += ",'" + QString::fromUtf8((*it_c)->getMyName().c_str()) +"'";
|
||||
//// } else {
|
||||
//// sql += ",NULL";
|
||||
//// }
|
||||
//// }
|
||||
// sql += ")";
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
// }
|
||||
sql += ")";
|
||||
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// sql = "INSERT INTO Hand (HandID,GameID,Sb_Amount,Bb_Amount";
|
||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// sql += ",Seat_" + QString::number((*it_c)->getMyID()+1,10) + "_Cash";
|
||||
// }
|
||||
//// for(i=1;i<=MAX_NUMBER_OF_PLAYERS; i++) {
|
||||
//// sql += ",Seat_" + QString("%1").arg(i) + "_Cash";
|
||||
//// }
|
||||
// sql += ") VALUES (";
|
||||
// sql += QString::number(handID,10);
|
||||
// sql += "," + QString::number(gameID,10);
|
||||
// sql += "," + QString::number(currentHand->getSmallBlind(),10);
|
||||
// sql += "," + QString::number(currentHand->getSmallBlind()*2,10);
|
||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
||||
// }
|
||||
//// for(it_c = currentHand->getSeatsList()->begin();it_c!=currentHand->getSeatsList()->end();it_c++) {
|
||||
//// if((*it_c)->getMyActiveStatus()) {
|
||||
//// sql += "," + QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10);
|
||||
//// } else {
|
||||
//// sql += ",NULL";
|
||||
//// }
|
||||
//// }
|
||||
// sql += ")";
|
||||
//
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
|
||||
//print cash only for active players
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
@@ -461,47 +461,47 @@ void Log::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int
|
||||
if(myConfig->readConfigInt("LogOnOff")) {
|
||||
//if write logfiles is enabled
|
||||
|
||||
QString sql;
|
||||
sql = "UPDATE Hand SET ";
|
||||
// QString sql;
|
||||
// sql = "UPDATE Hand SET ";
|
||||
//
|
||||
switch (roundID) {
|
||||
|
||||
switch (roundID) {
|
||||
|
||||
case 1: round = "Flop";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_1 = " + QString::number(card1,10) + ",";
|
||||
sql += "BoardCard_2 = " + QString::number(card2,10) + ",";
|
||||
sql += "BoardCard_3 = " + QString::number(card3,10);
|
||||
break;
|
||||
case 2: round = "Turn";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_4 = " + QString::number(card4,10);
|
||||
break;
|
||||
case 3: round = "River";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
||||
sql += "BoardCard_5 = " + QString::number(card5,10);
|
||||
break;
|
||||
default: round = "ERROR";
|
||||
}
|
||||
case 1: round = "Flop";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+"]"+"</br>\n";
|
||||
// sql += "BoardCard_1 = " + QString::number(card1,10) + ",";
|
||||
// sql += "BoardCard_2 = " + QString::number(card2,10) + ",";
|
||||
// sql += "BoardCard_3 = " + QString::number(card3,10);
|
||||
break;
|
||||
case 2: round = "Turn";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+"]"+"</br>\n";
|
||||
// sql += "BoardCard_4 = " + QString::number(card4,10);
|
||||
break;
|
||||
case 3: round = "River";
|
||||
logFileStreamString += "</br><b>"+round.toUpper()+"</b> [board cards <b>"+translateCardCode(card1).at(0)+"</b>"+translateCardCode(card1).at(1)+",<b>"+translateCardCode(card2).at(0)+"</b>"+translateCardCode(card2).at(1)+",<b>"+translateCardCode(card3).at(0)+"</b>"+translateCardCode(card3).at(1)+",<b>"+translateCardCode(card4).at(0)+"</b>"+translateCardCode(card4).at(1)+",<b>"+translateCardCode(card5).at(0)+"</b>"+translateCardCode(card5).at(1)+"]"+"</br>\n";
|
||||
// sql += "BoardCard_5 = " + QString::number(card5,10);
|
||||
break;
|
||||
default: round = "ERROR";
|
||||
}
|
||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||
writeLogFileStream(logFileStreamString);
|
||||
logFileStreamString = "";
|
||||
}
|
||||
|
||||
sql += " WHERE ";
|
||||
sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
|
||||
if(roundID <= 3) {
|
||||
if(mySqliteLogDb->isOpen()) {
|
||||
|
||||
QSqlQuery query(*mySqliteLogDb);
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// sql += " WHERE ";
|
||||
// sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
// sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
//
|
||||
// if(roundID <= 3) {
|
||||
// if(mySqliteLogDb->isOpen()) {
|
||||
//
|
||||
// QSqlQuery query(*mySqliteLogDb);
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -539,22 +539,22 @@ void Log::logFlipHoleCardsMsg(QString playerName, int playerID, int card1, int c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString sql = "UPDATE Hand SET ";
|
||||
sql += "Seat_" + QString::number(playerID+1,10) + "_Card_1 = " + QString::number(card1,10) + ",";
|
||||
sql += "Seat_" + QString::number(playerID+1,10) + "_Card_2 = " + QString::number(card2,10);
|
||||
sql += " WHERE ";
|
||||
sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
|
||||
if(mySqliteLogDb->isOpen()) {
|
||||
|
||||
QSqlQuery query(*mySqliteLogDb);
|
||||
if(!query.exec(sql)) {
|
||||
QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// QString sql = "UPDATE Hand SET ";
|
||||
// sql += "Seat_" + QString::number(playerID+1,10) + "_Card_1 = " + QString::number(card1,10) + ",";
|
||||
// sql += "Seat_" + QString::number(playerID+1,10) + "_Card_2 = " + QString::number(card2,10);
|
||||
// sql += " WHERE ";
|
||||
// sql += "HandID = " + QString::number(myW->getSession()->getCurrentGame()->getCurrentHandID(),10) + " AND ";
|
||||
// sql += "GameID = " + QString::number(myW->getSession()->getCurrentGame()->getMyGameID(),10);
|
||||
//
|
||||
// if(mySqliteLogDb->isOpen()) {
|
||||
//
|
||||
// QSqlQuery query(*mySqliteLogDb);
|
||||
// if(!query.exec(sql)) {
|
||||
// QMessageBox::critical(0, tr("ERROR"),query.lastError().text().toUtf8().data(), QMessageBox::Cancel);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user