constsql='UPDATE Gamestatus SET Red = 1+(SELECT Red FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");'+
teamname='Red';
'UPDATE S2C SET CardResultID = 2 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+';';
pointsRed=pointsRed+1;
console.log('addPoint Red:',sql);
}
db.query(
if(team==='blue'){
sql,
teamname='Blue';
(error)=>{
pointsBlue=pointsBlue+1;
if(error){
}
console.log(error);
constsql='UPDATE S2C SET CardResultID = 2 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+' AND (((SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 1 AND CardResultID = 0) OR (SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 0);SELECT ROW_COUNT() AS CheckUpdate;';
constsqlUpdate='UPDATE Gamestatus SET '+teamname+' = 1+(SELECT '+teamname+' FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");';
constsql='UPDATE Gamestatus SET Blue = 1+(SELECT Blue FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");'+
'UPDATE S2C SET CardResultID = 2 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+';';
constsql='UPDATE Gamestatus SET Red = -1+(SELECT Red FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");'+
teamname='Red';
'UPDATE S2C SET CardResultID = 4 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+';';
}
console.log('removePoint Red: ',sql);
if(team==='blue'){
db.query(
teamname='Blue';
sql,
}
(error)=>{
constsql='UPDATE S2C SET CardResultID = 4 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+' AND (((SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 1 AND CardResultID = 0) OR (SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 0);SELECT ROW_COUNT() AS CheckUpdate;';
constsql='UPDATE Gamestatus SET Blue = -1+(SELECT Blue FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");'+
if(checkUpdate===1){
'UPDATE S2C SET CardResultID = 4 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+';';
constsqlUpdate='UPDATE Gamestatus SET '+teamname+' = -1+(SELECT '+teamname+' FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\");';
constsql='UPDATE S2C SET CardResultID = 3 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+';';
constsql='UPDATE S2C SET CardResultID = 3 WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\") AND CardID = '+cardID+' AND (((SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 1 AND CardResultID = 0) OR (SELECT ActiveExplainer FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName = \"'+spielname+'\")) = 0);SELECT ROW_COUNT() AS CheckUpdate;';