I'm trying to insert some data into my Database.
But unfortunately I've a small problem with double date.
Because of my file representation which represents some football results and games.
e.g. Barcelona.txt
Spa;PRD;Espanyol;A;1;1;0;R;1396105200;14-03-29;Sat
Spa;UCL;Atletico Madrid;H;x;1;1;R;1396377900;14-04-01;Tue <--
Spa;PRD;Real Betis;H;1;3;1;R;1396713600;14-04-05;Sat
I will have some some rows with the same meaning
e.g. Atletico Madrid.txt will have a value
Spa;UCL;Barcelona;A;x;1;1;R;1396377900;14-04-01;Tue
which is the same. Therefore I will have these 2 values into my database
"1","Spa","UCL","Barcelona","Athletico_Madrid","H","x","1","1","R","1396377900","14-04-01","Tue "
"6","Spa","UCL","Athletico_Madrid","Barcelona","A","x","1","1","R","1396377900","14-04-01","Tue "
With other words, if I change some values, team A is Team B and visa versa. H <=> A, 1<=>0, outscore <=> homescore then i've the same row.
Actually it is easy to avoid these double values, by checking if there is an existing transformed row in the database.
rs = stmt.executeQuery( "SELECT * FROM WEDSTRIJD w WHERE " +
"w.DATE = '"+ date +"' and " +
"w.TEAM = '"+ opponent +"' and " +
"w.OPPONENT = '"+ team +"' and " +
"w.SCORED = "+ param[6] +" and " +
"w.AGAINST = "+ param[5] +" ;" );
But by doing this check,and if(rs.getRow() == 0) --> insert row . Everything has become enormously slow. Normally it will take 3 seconds to insert +100.000 rows but now via this check, it takes + 1h 25 minutes.
Thus does any one know a better solution? which isn't this horrible?