rzo1 commented on code in PR #1612: URL: https://github.com/apache/stormcrawler/pull/1612#discussion_r2235126938
########## external/sql/src/main/java/org/apache/stormcrawler/sql/IndexerBolt.java: ########## @@ -87,39 +81,32 @@ public void execute(Tuple tuple) { } try { - // which metadata to display? Map<String, String[]> keyVals = filterMetadata(metadata); - - StringBuilder query = - new StringBuilder(" insert into ") - .append(tableName) - .append(" (") - .append(fieldNameForURL()); - Object[] keys = keyVals.keySet().toArray(); - for (Object o : keys) { - query.append(", ").append((String) o); - } + // Build SQL statement with prepared statement + StringBuilder fieldsBuilder = new StringBuilder(fieldNameForURL()); Review Comment: I agree with @sigee here. We shouldn't create a lot of StringBuilders here and instead use parameter replacement were needed. In addition, I would add a simple (regex) check for the table name to avoid anything unexpected. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@stormcrawler.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org