diff --git a/core/src/main/java/google/registry/ui/server/console/ConsoleDumDownloadAction.java b/core/src/main/java/google/registry/ui/server/console/ConsoleDumDownloadAction.java index 4a1dd5ec57d..8a186d2dacd 100644 --- a/core/src/main/java/google/registry/ui/server/console/ConsoleDumDownloadAction.java +++ b/core/src/main/java/google/registry/ui/server/console/ConsoleDumDownloadAction.java @@ -49,8 +49,8 @@ SELECT CONCAT( d.domain_name,',',d.creation_time,',',d.registration_expiration_time,',',d.statuses ) AS result FROM "Domain" d WHERE d.current_sponsor_registrar_id = :registrarId - AND d.deletion_time > ':now' - AND d.creation_time <= ':now'; + AND d.deletion_time > :now + AND d.creation_time <= :now """; private static final FluentLogger logger = FluentLogger.forEnclosingClass(); @@ -107,8 +107,6 @@ protected void getHandler(User user) { } private void writeCsv(CSVPrinter printer) throws IOException { - String sql = SQL_TEMPLATE.replaceAll(":now", clock.now().toString()); - printer.printRecord( ImmutableList.of("Domain Name", "Creation Time", "Expiration Time", "Domain Statuses")); @@ -116,8 +114,9 @@ private void writeCsv(CSVPrinter printer) throws IOException { () -> { try (var resultStream = tm().getEntityManager() - .createNativeQuery(sql, String.class) + .createNativeQuery(SQL_TEMPLATE, String.class) .setParameter("registrarId", registrarId) + .setParameter("now", clock.now()) .setHint("org.hibernate.fetchSize", 1000) .getResultStream()) { diff --git a/core/src/main/java/google/registry/ui/server/console/ConsoleHistoryDataAction.java b/core/src/main/java/google/registry/ui/server/console/ConsoleHistoryDataAction.java index 138e1a1f4b8..3ef1d105b1b 100644 --- a/core/src/main/java/google/registry/ui/server/console/ConsoleHistoryDataAction.java +++ b/core/src/main/java/google/registry/ui/server/console/ConsoleHistoryDataAction.java @@ -53,7 +53,7 @@ public class ConsoleHistoryDataAction extends ConsoleApiAction { """ SELECT * FROM "ConsoleUpdateHistory" - WHERE SPLIT_PART(description, '|', 1) = :registrarId; + WHERE SPLIT_PART(description, '|', 1) = :registrarId """; public static final String PATH = "/console-api/history";