Skip to content

Commit fd6ecb7

Browse files
committed
Fix SQL capitalization and format in all the Vert.x benchmarks
Fix a typo that "world" is misspelled as "word" BTW.
1 parent a417041 commit fd6ecb7

File tree

4 files changed

+18
-18
lines changed
  • frameworks
    • Java
      • vertx-web/src/main/java/io/vertx/benchmark
      • vertx/src/main/java/vertx
    • Kotlin/vertx-web-kotlin-coroutines/src/main/kotlin/io/vertx/benchmark
    • Scala/vertx-web-scala/src/main/scala/vertx

4 files changed

+18
-18
lines changed

frameworks/Java/vertx-web/src/main/java/io/vertx/benchmark/App.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ private void createPgClientBenchmarkAsync(Vertx vertx, JsonObject config, Handle
5050
*/
5151
private final class PgClientBenchmark {
5252

53-
private static final String UPDATE_WORLD = "UPDATE world SET randomnumber=$1 WHERE id=$2";
54-
private static final String SELECT_WORLD = "SELECT id, randomnumber from WORLD where id=$1";
55-
private static final String SELECT_FORTUNE = "SELECT id, message from FORTUNE";
53+
private static final String UPDATE_WORLD = "UPDATE world SET randomnumber = $1 WHERE id = $2";
54+
private static final String SELECT_WORLD = "SELECT id, randomnumber FROM world WHERE id = $1";
55+
private static final String SELECT_FORTUNE = "SELECT id, message FROM fortune";
5656

5757
private final PgConnection client;
5858

frameworks/Java/vertx/src/main/java/vertx/App.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ static int getQueries(HttpServerRequest request) {
9090
private static final CharSequence JSON_LENGTH = HttpHeaders.createOptimized("" + new Message("Hello, World!").toJson().length());
9191
private static final CharSequence SERVER = HttpHeaders.createOptimized("vert.x");
9292

93-
private static final String SELECT_WORLD = "SELECT id, randomnumber from WORLD where id=$1";
94-
private static final String SELECT_FORTUNE = "SELECT id, message from FORTUNE";
95-
private static final String SELECT_WORLDS = "SELECT id, randomnumber from WORLD";
93+
private static final String SELECT_WORLD = "SELECT id, randomnumber FROM world WHERE id = $1";
94+
private static final String SELECT_FORTUNE = "SELECT id, message FROM fortune";
95+
private static final String SELECT_WORLDS = "SELECT id, randomnumber FROM world";
9696

9797
public static CharSequence createDateHeader() {
9898
return HttpHeaders.createOptimized(DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now()));
@@ -213,12 +213,12 @@ private Future<?> initClients(PgConnectOptions options) {
213213

214214
private static String buildAggregatedUpdateQuery(int len) {
215215
StringBuilder sql = new StringBuilder();
216-
sql.append("UPDATE WORLD SET RANDOMNUMBER = CASE ID");
216+
sql.append("UPDATE world SET randomnumber = CASE ID");
217217
for (int i = 0; i < len; i++) {
218218
int offset = (i * 2) + 1;
219219
sql.append(" WHEN $").append(offset).append(" THEN $").append(offset + 1);
220220
}
221-
sql.append(" ELSE RANDOMNUMBER");
221+
sql.append(" ELSE randomnumber");
222222
sql.append(" END WHERE ID IN ($1");
223223
for (int i = 1; i < len; i++) {
224224
int offset = (i * 2) + 1;
@@ -304,12 +304,12 @@ private void handleDb(HttpServerRequest req) {
304304
return;
305305
}
306306
Row row = resultSet.next();
307-
World word = new World(row.getInteger(0), row.getInteger(1));
307+
World world = new World(row.getInteger(0), row.getInteger(1));
308308
MultiMap headers = resp.headers();
309309
headers.add(HttpHeaders.SERVER, SERVER);
310310
headers.add(HttpHeaders.DATE, dateString);
311311
headers.add(HttpHeaders.CONTENT_TYPE, RESPONSE_TYPE_JSON);
312-
resp.end(word.toJson());
312+
resp.end(world.toJson());
313313
} else {
314314
sendError(req, res.cause());
315315
}

frameworks/Kotlin/vertx-web-kotlin-coroutines/src/main/kotlin/io/vertx/benchmark/App.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class App : CoroutineVerticle() {
3737
private const val SERVER = "vertx-web"
3838

3939
// for PgClientBenchmark only
40-
private const val UPDATE_WORLD = "UPDATE world SET randomnumber=$1 WHERE id=$2"
41-
private const val SELECT_WORLD = "SELECT id, randomnumber from WORLD where id=$1"
42-
private const val SELECT_FORTUNE = "SELECT id, message from FORTUNE"
40+
private const val UPDATE_WORLD = "UPDATE world SET randomnumber = $1 WHERE id = $2"
41+
private const val SELECT_WORLD = "SELECT id, randomnumber FROM world WHERE id = $1"
42+
private const val SELECT_FORTUNE = "SELECT id, message FROM fortune"
4343
}
4444

4545
inline fun Route.coroutineHandlerUnconfined(crossinline requestHandler: suspend (RoutingContext) -> Unit): Route =

frameworks/Scala/vertx-web-scala/src/main/scala/vertx/App.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class App extends ScalaVerticle {
102102

103103
private def handleDb(request: HttpServerRequest): Unit =
104104
client
105-
.preparedQuery("SELECT id, randomnumber from WORLD where id=$1")
105+
.preparedQuery("SELECT id, randomnumber FROM world WHERE id = $1")
106106
.execute(
107107
Tuple.of(App.randomWorld(), Nil: _*),
108108
(ar: AsyncResult[RowSet[Row]]) => {
@@ -128,7 +128,7 @@ class App extends ScalaVerticle {
128128
var failed = false
129129
while (i < queries) {
130130
client
131-
.preparedQuery("SELECT id, randomnumber from WORLD where id=$1")
131+
.preparedQuery("SELECT id, randomnumber FROM world WHERE id = $1")
132132
.execute(
133133
Tuple.of(App.randomWorld(), Nil: _*),
134134
(ar: AsyncResult[RowSet[Row]]) => {
@@ -159,7 +159,7 @@ class App extends ScalaVerticle {
159159

160160
val batch = worlds.map(world => Tuple.of(world.randomNumber, world.id)).toList.asJava
161161
conn
162-
.preparedQuery("UPDATE world SET randomnumber=$1 WHERE id=$2")
162+
.preparedQuery("UPDATE world SET randomnumber = $1 WHERE id = $2")
163163
.executeBatch(
164164
batch,
165165
(ar: AsyncResult[RowSet[Row]]) => {
@@ -184,7 +184,7 @@ class App extends ScalaVerticle {
184184
val id = App.randomWorld()
185185
val index = i
186186
client
187-
.preparedQuery("SELECT id, randomnumber from WORLD where id=$1")
187+
.preparedQuery("SELECT id, randomnumber FROM world WHERE id = $1")
188188
.execute(
189189
Tuple.of(id, Nil: _*),
190190
(ar2: AsyncResult[RowSet[Row]]) => {
@@ -206,7 +206,7 @@ class App extends ScalaVerticle {
206206

207207
private def handleFortunes(request: HttpServerRequest): Unit =
208208
client
209-
.preparedQuery("SELECT id, message from FORTUNE")
209+
.preparedQuery("SELECT id, message FROM fortune")
210210
.execute(
211211
(ar: AsyncResult[RowSet[Row]]) => {
212212
val response = request.response

0 commit comments

Comments
 (0)