Use prepared statements instead of string concatenated SQL everywhere - WIP (FINERACT-854)
This commit is contained in:
committed by
Petri Tuomola
parent
f96fc7df39
commit
859ce5af62
+1
-1
@@ -62,7 +62,7 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
|
|||||||
|
|
||||||
sql += " order by c.id";
|
sql += " order by c.id";
|
||||||
final List<GlobalConfigurationPropertyData> globalConfiguration = this.jdbcTemplate.query(sql, this.rm,
|
final List<GlobalConfigurationPropertyData> globalConfiguration = this.jdbcTemplate.query(sql, this.rm,
|
||||||
new Object[] { DataTableApiConstant.CATEGORY_PPI });
|
survey ? new Object[] { DataTableApiConstant.CATEGORY_PPI } : new Object[] {});
|
||||||
|
|
||||||
return new GlobalConfigurationData(globalConfiguration);
|
return new GlobalConfigurationData(globalConfiguration);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -281,7 +281,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
|
|
||||||
final List<ResultsetColumnValueData> columnValues = new ArrayList<>();
|
final List<ResultsetColumnValueData> columnValues = new ArrayList<>();
|
||||||
if (codeId != null) {
|
if (codeId != null) {
|
||||||
final String sql = "select v.id, v.code_value from m_code_value v where v.code_id =?" + " order by v.order_position, v.id";
|
final String sql = "select v.id, v.code_value from m_code_value v where v.code_id =? order by v.order_position, v.id";
|
||||||
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql, Integer.class, new Object[] { codeId });
|
final SqlRowSet rsValues = this.jdbcTemplate.queryForRowSet(sql, Integer.class, new Object[] { codeId });
|
||||||
rsValues.beforeFirst();
|
rsValues.beforeFirst();
|
||||||
while (rsValues.next()) {
|
while (rsValues.next()) {
|
||||||
@@ -297,7 +297,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
private SqlRowSet getDatatableMetaData(final String datatable) {
|
private SqlRowSet getDatatableMetaData(final String datatable) {
|
||||||
|
|
||||||
final String sql = "select COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMN_KEY"
|
final String sql = "select COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMN_KEY"
|
||||||
+ " from INFORMATION_SCHEMA.COLUMNS " + " where TABLE_SCHEMA = schema() and TABLE_NAME = ?" + " order by ORDINAL_POSITION";
|
+ " from INFORMATION_SCHEMA.COLUMNS " + " where TABLE_SCHEMA = schema() and TABLE_NAME = ? order by ORDINAL_POSITION";
|
||||||
|
|
||||||
final SqlRowSet columnDefinitions = this.jdbcTemplate.queryForRowSet(sql, String.class, new Object[] { datatable });
|
final SqlRowSet columnDefinitions = this.jdbcTemplate.queryForRowSet(sql, String.class, new Object[] { datatable });
|
||||||
if (columnDefinitions.next()) {
|
if (columnDefinitions.next()) {
|
||||||
|
|||||||
+7
-2
@@ -18,5 +18,10 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
-- two tables added: ReportCategoryList and FullReportList (FINERACT-1306)
|
-- two tables added: ReportCategoryList and FullReportList (FINERACT-1306)
|
||||||
INSERT INTO stretchy_report (report_name, report_type, report_category, report_sql, description, core_report, use_report)VALUES ("ReportCategoryList", 'Table', '(NULL)', '(NULL)', '(NULL)', 1, 1);
|
INSERT INTO stretchy_report (report_name, report_type, report_category, report_sql, description, core_report, use_report)
|
||||||
INSERT INTO stretchy_report (report_name, report_type, report_category, report_sql, description, core_report, use_report)VALUES ("FullReportList", 'Table', '(NULL)', '(NULL)', '(NULL)', 1, 1);
|
SELECT "ReportCategoryList", 'Table', '(NULL)', '(NULL)', '(NULL)', 1, 1
|
||||||
|
ON DUPLICATE key UPDATE report_name = 'ReportCategoryList';
|
||||||
|
|
||||||
|
INSERT INTO stretchy_report (report_name, report_type, report_category, report_sql, description, core_report, use_report)
|
||||||
|
SELECT "FullReportList", 'Table', '(NULL)', '(NULL)', '(NULL)', 1, 1
|
||||||
|
ON DUPLICATE key UPDATE report_name = 'FullReportList';
|
||||||
|
|||||||
Reference in New Issue
Block a user