-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: makes escape processing strict according to JDBC spec
before, escape code parsing was very lenient and invalid escape code formats were accidentally processed. closes #657
- Loading branch information
Showing
4 changed files
with
138 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
ubenchmark/src/main/java/org/postgresql/benchmark/escaping/EscapeProcessing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
package org.postgresql.benchmark.escaping; | |||
|
|||
import org.postgresql.core.Parser; | |||
|
|||
import org.openjdk.jmh.annotations.Benchmark; | |||
import org.openjdk.jmh.annotations.BenchmarkMode; | |||
import org.openjdk.jmh.annotations.Measurement; | |||
import org.openjdk.jmh.annotations.Mode; | |||
import org.openjdk.jmh.annotations.OutputTimeUnit; | |||
import org.openjdk.jmh.annotations.Scope; | |||
import org.openjdk.jmh.annotations.State; | |||
import org.openjdk.jmh.annotations.Threads; | |||
import org.openjdk.jmh.annotations.Warmup; | |||
|
|||
import java.util.concurrent.TimeUnit; | |||
|
|||
@Measurement(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) | |||
@Warmup(iterations = 10, time = 1, timeUnit = TimeUnit.SECONDS) | |||
@State(Scope.Thread) | |||
@Threads(1) | |||
@BenchmarkMode(Mode.AverageTime) | |||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | |||
public class EscapeProcessing { | |||
|
|||
private String fnEscapeSQL = "{fn week({d '2005-01-24'})}"; | |||
private boolean replaceProcessingEnabled = true; | |||
private boolean standardConformingStrings = false; | |||
|
|||
@Benchmark | |||
public String escapeFunctionWithDate() throws Exception { | |||
return Parser.replaceProcessing(fnEscapeSQL, replaceProcessingEnabled, standardConformingStrings); | |||
} | |||
} |