1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78. | public static int wczytajZBazy() throws SQLException, ClassNotFoundException
{
int i=0;
int j=0;
Class.forName(\"org.sqlite.JDBC\");
int [][] tablica1 = new int[9][9];
int [][] tablica2 = new int[2][10];
int [][] tablica3 = new int[2][10];
java.sql.Connection con = DriverManager.getConnection(\"jdbc:sqlite:tablica.db\");
java.sql.Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(\"SELECT * FROM komorka;\");
while (rs.next())
{
if(j==9){
j=0;
i++;}
tablica1[i][j] = Integer.parseInt(rs.getString(1));
WstawWartosc(i, j, tablica1[i][j]);
j++;
}
rs.close();
ResultSet rs3 = stmt.executeQuery(\"SELECT * FROM jeniec;\");
j=0;
while (rs3.next())
{
if(j==10){
j=0;
i++;}
tablica2[i][j] = Integer.parseInt(rs.getString(1));
WstawWartoscJeniec(i, j, tablica2[i][j]);
j++;
}
rs3.close();
ResultSet rs4 = stmt.executeQuery(\"SELECT * FROM jeniecPrzeciwnik;\");
j=0;
while (rs4.next())
{
if(j==10){
j=0;
i++;}
tablica3[i][j] = Integer.parseInt(rs.getString(1));
WstawWartoscJeniecPrzeciwnik(i, j, tablica3[i][j]);
j++;
}
rs4.close();
ResultSet rs2 = stmt.executeQuery(\"SELECT * FROM los;\");
boolean los=rs2.next();
rs2.close();
con.close();
int b;
if(los==true){
b=0;
}else{
b=1;
}
return b;
}
}
|