public static ImportedCustomer updateCustomer(ImportedCustomer existingClienCustomer) { // print // "UPDATE parsed_lines SET current = $customer->{current} WHERE customer_number = // $customer->{customer_number}\n"; if (existingClienCustomer != null) { // try { // Statement stmt = connection.createStatement(); String string = "UPDATE imported_customer SET status = '" + existingClienCustomer.getStatus() + "' file_id = '" + existingClienCustomer.getFileId() + "' customer_name = '" + existingClienCustomer.getCustomerName() + "' WHERE customer_number = ? '" + existingClienCustomer.getCustomerNumber() + "';"; System.out.println(string); // stmt.executeUpdate(string); // } catch (SQLException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } // TODO Auto-generated method stub return null; }
public static ImportedCustomer setCustomer(ImportedCustomer existingClienCustomer) { try { final Statement statement = connection.createStatement(); String sql = "INSERT INTO imported_customer (status, file_id, customer_number, customer_name) " + "VALUES ('" + existingClienCustomer.getStatus() + "', '" + existingClienCustomer.getFileId() + "', '" + existingClienCustomer.getCustomerNumber() + "', '" + existingClienCustomer.getCustomerName() + "' );"; statement.executeUpdate(sql); statement.close(); return null; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // TODO Auto-generated method stub return null; }