<commit_before>package io.github.likcoras.ssbot.backends;

import io.github.likcoras.ssbot.ConfigParser;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.IllegalFormatException;

public class DbHandler {
	
	private final String host;
	private final int port;
	
	private final String user;
	private final String pass;
	
	private final String database;
	private final String table;
	private final String titles;
	private final String id;
	
	public DbHandler(final ConfigParser cfg) {
		
		host = cfg.getProperty("dbhost");
		port = Integer.parseInt(cfg.getProperty("dbport"));
		
		user = cfg.getProperty("dbuser");
		pass = cfg.getProperty("dbpass");
		
		database = cfg.getProperty("dbdatabase");
		table = cfg.getProperty("dbtable");
		titles = cfg.getProperty("dbcolumntitle");
		id = cfg.getProperty("dbcolumnid");
		
		try {
			
			Class.forName("com.mysql.jdbc.Driver");
			
		} catch (final ClassNotFoundException e) {
			
			System.out.println("Error: Unable to load mysql driver!");
			System.out
					.println("Please send the following error message to the author:");
			e.printStackTrace();
			
		}
		
	}
	
	public int getId(final String... s) {
		
		int i = -1;
		String qr = "";
		
		for (final String k : s) {
			qr += String.format("%s LIKE '%%%s%%' AND ", titles, k);
		}
		
		qr =
				String.format("SELECT * FROM %s.%s WHERE %s LIMIT 0,1",
						database, table, qr.substring(0, qr.length() - 5));
		
		try {
			
			final Connection con = makeCon();
			
			final Statement st = con.createStatement();
			final ResultSet res = st.executeQuery(qr);
			
			if (res.next()) {
				i = res.getInt(id);
			}
			
			con.close();
			
		} catch (final SQLException e) {
			
			System.out
					.println("Error: Exception while querying the database!!");
			System.out
					.println("Please send the following error message to the author:");
			e.printStackTrace();
			i = -2;
			
		}
		
		return i;
		
	}<commit_msg>Try to make things more readable<commit_after>package io.github.likcoras.ssbot.backends;

import io.github.likcoras.ssbot.ConfigParser;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.IllegalFormatException;

public class DbHandler {
	
	private final String host;
	private final int port;
	
	private final String user;
	private final String pass;
	
	private final String database;
	private final String table;
	private final String titles;
	private final String id;
	
	public DbHandler(final ConfigParser cfg) {
		
		host = cfg.getProperty("dbhost");
		port = Integer.parseInt(cfg.getProperty("dbport"));
		
		user = cfg.getProperty("dbuser");
		pass = cfg.getProperty("dbpass");
		
		database = cfg.getProperty("dbdatabase");
		table = cfg.getProperty("dbtable");
		titles = cfg.getProperty("dbcolumntitle");
		id = cfg.getProperty("dbcolumnid");
		
		try {
			
			Class.forName("com.mysql.jdbc.Driver");
			
		} catch (final ClassNotFoundException e) {
			
			System.out.println("Error: Unable to load mysql driver!");
			System.out
					.println("Please send the following error message to the author:");
			e.printStackTrace();
			
		}
		
	}
	
	public int getId(final String... keywords) {
		
		int i = -1;
		String query = "";
		
		for (final String keyword : keywords) {
			query += String.format("%s LIKE '%%%s%%' AND ", titles, keyword);
		}
		
		query =
				String.format("SELECT * FROM %s.%s WHERE %s LIMIT 0,1",
						database, table, query.substring(0, query.length() - 5));
		
		try {
			
			final Connection con = makeCon();
			
			final Statement state = con.createStatement();
			final ResultSet result = state.executeQuery(query);
			
			if (result.next()) {
				i = result.getInt(id);
			}
			
			con.close();
			
		} catch (final SQLException e) {
			
			System.out
					.println("Error: Exception while querying the database!!");
			System.out
					.println("Please send the following error message to the author:");
			e.printStackTrace();
			i = -2;
			
		}
		
		return i;
		
	}
{'fraction_non_alphanumeric': 0.12632594021215043, 'fraction_numerical': 0.0028929604628736743, 'mean_word_length': 3.2423312883435584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7659165', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1247, 'n_words': 351}