<commit_before>package app.shoppingcart;

import app.DBC;

import java.sql.Statement;

/**
 * Created by onno on 25-1-2017.
 */
public class shoppingcartQueries {
    public void addItemToShoppingCart(String UsernameCustomer, String productid, String quantity) {
        try {
            DBC databasePandaShop = new DBC();
            Statement stat = databasePandaShop.Connection();
            String query = ("insert into shoppingcart(usernamecustomer, productid, quantity) values('"+ UsernameCustomer+ "', '"+ productid + "', '" + quantity+ "');");
            stat.executeUpdate(query);
            stat.getConnection().commit();
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }
    }

}
<commit_msg>juu, shoppingcart zooi nog meer + test in sql<commit_after>package app.shoppingcart;

import app.DBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

/**
 * Created by onno on 25-1-2017.
 */
public class shoppingcartQueries {
    public void addItemToShoppingCart(String UsernameCustomer, String productid, String quantity) {
        try {
            //tested in sql, not tested in webpage
            DBC databasePandaShop = new DBC();
            Statement stat = databasePandaShop.Connection();
            String query = ("insert into shoppingcart(usernamecustomer, productid, quantity) values('"+ UsernameCustomer+ "', '"+ productid + "', '" + quantity+ "');");
            stat.executeUpdate(query);
            stat.getConnection().commit();
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }
    }
    public void deleteProductShoppingCart(String productId, String usernamecustomer){
        try {
            DBC databasePandaShop = new DBC();
            Statement stat = databasePandaShop.Connection();
            String query = ("DELETE FROM product WHERE productid = '" + productId + "' and usernamecustomer = '" + usernamecustomer + "' ;");
            stat.executeUpdate(query);
            stat.getConnection().commit();
            stat.close();
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        }

    }
    public static ArrayList<String> selectShoppingCartItems(String valueName, String usernamecustomer) throws SQLException {
        DBC dbc = new DBC();
        Statement stat = dbc.Connection();
        ArrayList<String> shoppingcartuserlist = null;

        try {
            //tested in sql, not tested in webpage
            String query = ("SELECT " + valueName + " AS shoppingcartuser FROM shoppingcart where usernamecustomer = '"+ usernamecustomer+ "');");
            stat.getConnection().commit();
            ResultSet rs = stat.executeQuery(query);
            shoppingcartuserlist = new ArrayList<String>();
            if (rs.next()) {
                String getProductId = rs.getString(valueName);
                System.out.println(getProductId);
                shoppingcartuserlist.add(getProductId);
            }
        } catch (Exception e) {
            System.err.println(e.getClass().getName() + ": " + e.getMessage());
            System.exit(0);
        } finally {
            if (stat != null) {
                stat.close();
            }
        }
        {
            return shoppingcartuserlist;
        }

    }

}

{'fraction_non_alphanumeric': 0.12302483069977427, 'fraction_numerical': 0.005079006772009029, 'mean_word_length': 2.297674418604651, 'pattern_counts': {'":': 4, '<': 6, '<?xml version=': 0, '>': 6, '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': '2888058', 'n_tokens_mistral': 933, 'n_tokens_neox': 924, 'n_words': 217}