private PreparedStatement buildDeleteStatement(Connection conn_loc, String tableName, String whereField)
            throws SQLException {
        final StringBuffer sql = new StringBuffer("DELETE FROM ");
        sql.append(tableName);

        // delete all records if whereField is null
        if (whereField != null) {
            sql.append(" WHERE ");
            (sql.append(whereField)).append(" = ?");
        }

        final String finalSQL = sql.toString();
//		System.out.println(finalSQL);
        return conn_loc.prepareStatement(finalSQL);
    }