mirror of https://github.com/apache/druid.git
use prepared statement instead of string interpolation
This commit is contained in:
parent
e0ff2aa0d6
commit
6e18ff7ed4
|
@ -74,13 +74,15 @@ public class DatabaseRuleManager
|
|||
@Override
|
||||
public Void withHandle(Handle handle) throws Exception
|
||||
{
|
||||
List<Map<String, Object>> existing = handle.select(
|
||||
String.format(
|
||||
"SELECT id from %s where datasource='%s';",
|
||||
ruleTable,
|
||||
defaultTier
|
||||
List<Map<String, Object>> existing = handle
|
||||
.createQuery(
|
||||
String.format(
|
||||
"SELECT id from %s where datasource=:dataSource;",
|
||||
ruleTable
|
||||
)
|
||||
)
|
||||
);
|
||||
.bind("dataSource", defaultTier)
|
||||
.list();
|
||||
|
||||
if (!existing.isEmpty()) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue