public PreparedStatement prepare(String query, String... params) {
        if (isOpen()) {
            try {
                PreparedStatement statement = this.connection.prepareStatement(query);

                int count = 1;

                if (params != null) {
                    for (String value : params) {
                        for (char c : query.toCharArray()) {
                            if (c == '?') {
                                statement.setString(count, value);
                            }
                        }
                        count++;
                    }
                }

                return statement;
            }
            catch (SQLException ex) {
                return null;
            }
        }
        else {
            return null;
        }
    }