private String generateSelectSQL(SisSettings sisSettings) { String activeField = isNotEmpty(sisSettings.activeFieldName()) ? ", " + sisSettings.activeFieldName() : ""; String nameFields = isNotEmpty(sisSettings.getLastNameField()) ? ", " + sisSettings.getFirstNameField() + ", " + sisSettings.getLastNameField() + " " : ""; return "select " + sisSettings.studentIDFieldName() + "," + sisSettings.freeFieldName() + ", " + sisSettings.reducedFieldName() + activeField + nameFields + " from " + sisSettings.getStudentsTable(); }
private String generateInsertSQL(SisSettings sisSettings) { return "insert into " + sisSettings.getStudentsTable() + " (" + sisSettings.studentIDFieldName() + ", " + sisSettings.freeFieldName() + ", " + sisSettings.reducedFieldName() + (isNotEmpty(sisSettings.activeFieldName()) ? "," + sisSettings.activeFieldName() : "") + (isNotEmpty(sisSettings.getFirstNameField()) ? "," + sisSettings.getFirstNameField() : "") + (isNotEmpty(sisSettings.getLastNameField()) ? "," + sisSettings.getLastNameField() : "") + ") values ( ?, ?, ?" + (isNotEmpty(sisSettings.activeFieldName()) ? ", ?" : "") + (isNotEmpty(sisSettings.getFirstNameField()) ? ", ?" : "") + (isNotEmpty(sisSettings.getLastNameField()) ? ", ?" : "") + ")"; }