summaryrefslogtreecommitdiff
path: root/Aktywator/Bws.cs
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-11-09 14:20:32 +0100
committeremkael <emkael@tlen.pl>2016-11-14 14:47:04 +0100
commit3fd493b395d27749749587518d76a4e5d648920c (patch)
tree325daa433c497945657a53e266b4fc5d102bf332 /Aktywator/Bws.cs
parentbe59baaa024f8c5f02ec14fe34155e736548046b (diff)
* PBN double-dummy data support for HandEvaluation table
Diffstat (limited to 'Aktywator/Bws.cs')
-rw-r--r--Aktywator/Bws.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 0be06df..eda99a1 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -104,6 +104,8 @@ namespace Aktywator
return false;
if (!sql.checkTableExists("HandRecord"))
return false;
+ if (!sql.checkTableExists("HandEvaluation"))
+ return false;
return true;
}
@@ -167,6 +169,19 @@ namespace Aktywator
catch (OleDbException)
{
}
+ try
+ {
+ sql.query("CREATE TABLE HandEvaluation (`Section` integer, `Board` integer, "
+ + "NorthSpades integer,NorthHearts integer,NorthDiamonds integer,NorthClubs integer,NorthNotrump integer,"
+ + "EastSpades integer,EastHearts integer,EastDiamonds integer,EastClubs integer,EastNotrump integer,"
+ + "SouthSpades integer,SouthHearts integer,SouthDiamonds integer,SouthClubs integer,SouthNotrump integer,"
+ + "WestSpades integer,WestHearts integer,WestDiamonds integer,WestClubs integer,WestNotrump integer,"
+ + "NorthHcp integer,EastHcp integer,SouthHcp integer,WestHcp integer"
+ + ");");
+ }
+ catch (OleDbException)
+ {
+ }
}
public void updateSettings()
@@ -377,6 +392,7 @@ namespace Aktywator
public void loadHandRecords(PBN pbn)
{
sql.query("DELETE FROM HandRecord");
+ sql.query("DELETE FROM HandEvaluation");
for (int i = 0; i < pbn.handRecords.Length; i++)
if (pbn.handRecords[i] != null)
for (int section = 1; section <= highSection(); section++)
@@ -403,6 +419,24 @@ namespace Aktywator
str.Append(b.west[2]); str.Append("','");
str.Append(b.west[3]); str.Append("')");
sql.query(str.ToString());
+ int[,] ddTable = pbn.ddTables[i].GetDDTable();
+ if (ddTable != null)
+ {
+ StringBuilder ddStr = new StringBuilder();
+ ddStr.Append("INSERT INTO HandEvaluation VALUES(");
+ ddStr.Append(section); ddStr.Append(",");
+ ddStr.Append(i); ddStr.Append(",");
+ for (int player = 0; player < 4; player++)
+ {
+ for (int denom = 0; denom < 5; denom++)
+ {
+ ddStr.Append(ddTable[player, denom]);
+ ddStr.Append(",");
+ }
+ }
+ ddStr.Append("0,0,0,0)"); // HCP not supported yet
+ sql.query(ddStr.ToString());
+ }
}
}
}