<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.app.database;

import com.app.exceptions.DatabaseException;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.LinkedList;

/**
 *
 * @author VJ
 */
public class DatabaseModel {

    private DatabaseType selected;
    private Connection database_con;
    private final String Path, Username, Password, TableName;
    private final String UserList_SQL_QUERY;

    public  DatabaseModel(DatabaseType dt, String path, String username, String password, String tablename) throws DatabaseException {
        try {
            selected = dt;
            Path = path;
            Username = username;
            Password = password;
            TableName = tablename;
            Class.forName(selected.getDriver()).newInstance();
            UserList_SQL_QUERY = "Select Uscername from " + TableName+";";
            createConnection();
        } catch (ClassNotFoundException ex) {
            throw new DatabaseException("ClassNotFoundException : Could not find Instance of Driver " + selected.name() + " interface implementation.", ex);
        } catch (InstantiationException ex) {
            throw new DatabaseException("InstantiationException : Could not create Instance of specified Driver " + selected.name() + " Interface implementation. : ", ex);
        } catch (IllegalAccessException ex) {
            throw new DatabaseException("IllegalAccessException : Could Not Access the method/constructor of a " + selected.name() + " class", ex);
        }
    }

    public static void execute() throws DatabaseException {
        DatabaseModel db = new DatabaseModel(DatabaseType.H2, "", "sa", "","");
        db.initConnection();
        
        System.out.print(db.registerUser("d", "dd", "fff"));
    }

    public void createConnection() throws DatabaseException {
        try {
            database_con = DriverManager.getConnection(selected.getAddress() + Path, Username, Password);<commit_msg>Fixed Bug in SQL Query<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.app.database;

import com.app.exceptions.DatabaseException;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.LinkedList;

/**
 *
 * @author VJ
 */
public class DatabaseModel {

    private DatabaseType selected;
    private Connection database_con;
    private final String Path, Username, Password, TableName;
    private final String UserList_SQL_QUERY;

    public  DatabaseModel(DatabaseType dt, String path, String username, String password, String tablename) throws DatabaseException {
        try {
            selected = dt;
            Path = path;
            Username = username;
            Password = password;
            TableName = tablename;
            Class.forName(selected.getDriver()).newInstance();
            UserList_SQL_QUERY = "Select Username from " + TableName+";";
            createConnection();
        } catch (ClassNotFoundException ex) {
            throw new DatabaseException("ClassNotFoundException : Could not find Instance of Driver " + selected.name() + " interface implementation.", ex);
        } catch (InstantiationException ex) {
            throw new DatabaseException("InstantiationException : Could not create Instance of specified Driver " + selected.name() + " Interface implementation. : ", ex);
        } catch (IllegalAccessException ex) {
            throw new DatabaseException("IllegalAccessException : Could Not Access the method/constructor of a " + selected.name() + " class", ex);
        }
    }

    public static void execute() throws DatabaseException {
        DatabaseModel db = new DatabaseModel(DatabaseType.H2, "", "sa", "","");
        db.initConnection();
        
        System.out.print(db.registerUser("d", "dd", "fff"));
    }

    public void createConnection() throws DatabaseException {
        try {
            database_con = DriverManager.getConnection(selected.getAddress() + Path, Username, Password);
{'fraction_non_alphanumeric': 0.09540481400437636, 'fraction_numerical': 0.000437636761487965, 'mean_word_length': 3.1668185961713764, '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': '1546041', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1122, 'n_words': 353}