changed word list so hopefully no more undefined behaviour by list in coroutine environment
This commit is contained in:
@@ -9,15 +9,16 @@ import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
import DataLayer.settings;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author install1
|
||||
*/
|
||||
public class DBCPDataSource {
|
||||
private static BasicDataSource ds = new BasicDataSource();
|
||||
private static BasicDataSource ds = new BasicDataSource();
|
||||
|
||||
static {
|
||||
try {
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
@@ -28,6 +29,7 @@ public class DBCPDataSource {
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
ds.setMaxOpenPreparedStatements(100);
|
||||
System.out.println("called BasicDataSource ");
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DBCPDataSource.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DataMapper {
|
||||
return arrayListStr;
|
||||
}
|
||||
|
||||
public static void InsertMYSQLStrings(ArrayList<String> str) throws SQLException {
|
||||
public static void InsertMYSQLStrings(String str) throws SQLException {
|
||||
Connection l_cCon = null;
|
||||
PreparedStatement l_pStatement = null;
|
||||
ResultSet l_rsSearch = null;
|
||||
@@ -47,10 +47,8 @@ public class DataMapper {
|
||||
try {
|
||||
l_cCon = DBCPDataSource.getConnection();
|
||||
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
||||
for (String str1 : str) {
|
||||
l_pStatement.setString(1, str1);
|
||||
l_pStatement.execute();
|
||||
}
|
||||
l_pStatement.setString(1, str);
|
||||
l_pStatement.execute();
|
||||
} finally {
|
||||
CloseConnections(l_pStatement, l_rsSearch, l_cCon);
|
||||
}
|
||||
@@ -88,7 +86,7 @@ public class DataMapper {
|
||||
String CountSQL = "select count(*) from Sentences";
|
||||
String l_sSQL = "delete from Sentences\n" +
|
||||
" where DATE(last_used) < DATE_SUB(CURDATE(), INTERVAL 32 DAY)\n" +
|
||||
" order by last_used asc limit 5";
|
||||
" order by last_used asc limit 2";
|
||||
try {
|
||||
l_cCon = DBCPDataSource.getConnection();
|
||||
l_pStatement = l_cCon.prepareStatement(CountSQL);
|
||||
|
||||
Reference in New Issue
Block a user