From bc965ba428a0eaf02fc2200016fa60f9e22bd8e0 Mon Sep 17 00:00:00 2001
From: xingyutangyuan <147447743+xingyutangyuan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 23:16:00 -0800
Subject: [PATCH 1/4] Tweak the format of GoogleSql javadoc
---
.../src/main/java/com/google/mu/safesql/GoogleSql.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java b/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
index 600e95b109..e189ac1694 100644
--- a/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
+++ b/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
@@ -23,9 +23,11 @@ public final class GoogleSql {
/**
- * Similar to {@link SafeQuery#template}, except {@link Instant} are translated to `TIMESTAMP()` GoogleSql function,
- * {@link ZonedDateTime} are translated to `DTETIME()` GoogleSql function, and {@link LocalDate} are translated
- * to `DATE()` GoogleSql function.
+ * Similar to {@link SafeQuery#template}, but applies additional GoogleSQL translation rules.
+ *
+ *
Specifically, {@link Instant} are translated to `TIMESTAMP()` GoogleSql function,
+ * {@link ZonedDateTime} are translated to `DTETIME()` GoogleSql function,
+ * and {@link LocalDate} are translated to `DATE()` GoogleSql function.
*/
public static StringFormat.To template(@CompileTimeConstant String formatString) {
return SafeQuery.template(formatString, value -> {
From 4154626b3d9738273783d477190d1b51576e81ef Mon Sep 17 00:00:00 2001
From: xingyutangyuan <147447743+xingyutangyuan@users.noreply.github.com>
Date: Tue, 28 Nov 2023 23:44:30 -0800
Subject: [PATCH 2/4] Fix GoogleSqlTest
---
.../java/com/google/mu/safesql/GoogleSql.java | 2 +-
.../java/com/google/mu/safesql/SafeQuery.java | 16 +++++++++-------
.../com/google/mu/safesql/GoogleSqlTest.java | 11 ++++++++++-
.../com/google/mu/safesql/SafeQueryTest.java | 2 +-
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java b/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
index e189ac1694..3392a5130a 100644
--- a/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
+++ b/mug-guava/src/main/java/com/google/mu/safesql/GoogleSql.java
@@ -23,7 +23,7 @@ public final class GoogleSql {
/**
- * Similar to {@link SafeQuery#template}, but applies additional GoogleSQL translation rules.
+ * Much like {@link SafeQuery#template}, but with additional GoogleSQL translation rules.
*
* Specifically, {@link Instant} are translated to `TIMESTAMP()` GoogleSql function,
* {@link ZonedDateTime} are translated to `DTETIME()` GoogleSql function,
diff --git a/mug-guava/src/main/java/com/google/mu/safesql/SafeQuery.java b/mug-guava/src/main/java/com/google/mu/safesql/SafeQuery.java
index 88cc20bd43..9d7a429cc5 100644
--- a/mug-guava/src/main/java/com/google/mu/safesql/SafeQuery.java
+++ b/mug-guava/src/main/java/com/google/mu/safesql/SafeQuery.java
@@ -132,7 +132,8 @@ static StringFormat.To template(
placeholders
.collect(
new StringBuilder(),
- (b, p, v) -> b.append(it.next()).append(fillInPlaceholder(p, v, defaultConverter)))
+ (b, p, v) ->
+ b.append(it.next()).append(fillInPlaceholder(p, v, defaultConverter)))
.append(it.next())
.toString());
});
@@ -158,7 +159,7 @@ public int hashCode() {
}
private static String fillInPlaceholder(
- Substring.Match placeholder, Object value, Function