Seikez wrote:
Can't you get info on the db-schema from PostgreSQL in some way? (I have never worked with PostgreSQL, but it would be strange if this wasn't possible either from PostgreSQL directly, or from some free tool)
It's possible to get the info on the db-schema, however it's a lot of abbreviations etc.. so not very easy to understand.
It's likely it'll be
similar to the PT3 db and abbreviations but who knows.
This is an example for getting Preflop stats.
Code:
public static double[] getPreflopStats(String name, Connection con) {
double[] stats = new double[6];
int id_player = 1;
PreparedStatement pst = null;
ResultSet rs = null;
try {
// Get player ID
String stm = "SELECT id_player FROM player WHERE player_name = ?;";
pst = con.prepareStatement(stm);
pst.setString(1, name);
rs = pst.executeQuery();
while (rs.next()) {
id_player = rs.getInt(1);
}
stm = "SELECT "+
"( SUM(cnt_p_raise) / ( 1.0 + SUM(cnt_p_raise) + SUM(cnt_p_call) + SUM(cnt_p_fold) ) ), "+ //AFq
"( SUM(cnt_p_raise)*1.0 / SUM(cnt_hands) ), "+ //PFR
"( SUM(cnt_vpip)*1.0 / SUM(cnt_hands) ), "+ //VPIP
"( SUM(cnt_p_first_raise) / ( 1.0 + SUM(cnt_p_open_opp)) ) , "+//RAISEFIRST
"( SUM(cnt_p_3bet) / (1.0 + SUM(cnt_p_3bet_opp)) ), "+ //3BET
"SUM(cnt_hands) "+
"FROM holdem_cache WHERE id_player = ?;";
pst = con.prepareStatement(stm);
pst.setInt(1, id_player);
rs = pst.executeQuery();
while (rs.next()) {
for (int i=0; i<stats.length; i++) {
stats[i] = rs.getDouble(i+1);
}
}
<more code here..>
}
return stats;
}