Answer the question
In order to leave comments, you need to log in
Why is the query to the database not being executed?
Hello! The problem with the execution of the request, I can not understand what's what! There is a function selectDataOfTable , which receives the selection schema and the table itself as input. Sadness arises when I try to unload data from the VacanciesOfEmployers table (table schema below), when:
- When querying:
"SELECT VacanciesOfEmployers.id, Employers.name, Employers.contacts, Employers.hr_specialist, Vacancies.name, requirement, minCost, maxCost, placementDate FROM (VacanciesOfEmployers INNER JOIN Employers ON VacanciesOfEmployers.id_employer = Employers.id) INNER JOIN Vacancies ON Vacancies.id = VacanciesOfEmployers.id_vacancy"
"SELECT Employers.name, Employers.contacts, Employers.hr_specialist, Vacancies.name, requirement, minCost, maxCost, placementDate FROM (VacanciesOfEmployers INNER JOIN Employers ON VacanciesOfEmployers.id_employer = Employers.id) INNER JOIN Vacancies ON Vacancies.id = VacanciesOfEmployers.id_vacancy"
"SELECT * FROM (VacanciesOfEmployers INNER JOIN Employers ON VacanciesOfEmployers.id_employer = Employers.id) INNER JOIN Vacancies ON Vacancies.id = VacanciesOfEmployers.id_vacancy"
String[] columns = this.getColumnsForTable(select, tableName);
List<Object[]> result = new ArrayList<>();
ResultSet rs = cursor.executeQuery("SELECT "+ select +" FROM "+ tableName +" ORDER BY name ASC");
/** прочитываем значения из RS и заполняем массив в соотвествии со столбцами */
while(rs.next()) {
Object[] row = new Object[columns.length];
for (int i=0; i<columns.length; i++) {
row[i] = rs.getString(columns[i]);
}
result.add(row);
}
return result;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question