Skip to content

Commit a5de3e7

Browse files
authored
Make URI parsers store extra parameters to the connection properties (#1576)
Closes #664 Applies to DB2, MSSQL, MySQL and PostgreSQL clients. Oracle client already has this behavior. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent d34d5dc commit a5de3e7

8 files changed

Lines changed: 26 additions & 29 deletions

File tree

vertx-db2-client/src/main/asciidoc/index.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ The URI format for a connection string is:
143143
db2://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]
144144
----
145145

146+
NOTE: Configuring parameters in connection URI will override the default properties.
147+
146148
Currently, the client supports the following parameter keys:
147149

148150
* `host`
@@ -151,7 +153,9 @@ Currently, the client supports the following parameter keys:
151153
* `password`
152154
* `database`
153155

154-
NOTE: Configuring parameters in connection URI will override the default properties.
156+
Additional parameters will be added to the {@link io.vertx.sqlclient.SqlConnectOptions#getProperties properties}.
157+
158+
NOTE: The connection URI parser transforms all property keys to lower case.
155159

156160
== Connect retries
157161

vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2ConnectionUriParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private static void parseAttributes(String attributesInfo, JsonObject configurat
179179
configuration.put("database", value);
180180
break;
181181
default:
182-
configuration.put(key, value);
182+
properties.put(key, value);
183183
break;
184184
}
185185
}

vertx-mssql-client/src/main/asciidoc/index.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ The connection URI format is defined by the client in an idiomatic way:
118118
sqlserver://[user[:[password]]@]host[:port][/database][?<key1>=<value1>[&<key2>=<value2>]]
119119
----
120120

121+
NOTE: Configuring parameters in connection URI will override the default properties.
122+
121123
Currently, the client supports the following parameter keys:
122124

123125
* `host`
@@ -126,7 +128,9 @@ Currently, the client supports the following parameter keys:
126128
* `password`
127129
* `database`
128130

129-
NOTE: Configuring parameters in connection URI will override the default properties.
131+
Additional parameters will be added to the {@link io.vertx.sqlclient.SqlConnectOptions#getProperties properties}.
132+
133+
NOTE: The connection URI parser transforms all property keys to lower case.
130134

131135
== Connect retries
132136

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/MSSQLConnectionUriParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private static void parseAttributes(String attributesInfo, JsonObject configurat
175175
configuration.put("database", value);
176176
break;
177177
default:
178-
configuration.put(key, value);
178+
properties.put(key, value);
179179
break;
180180
}
181181
}

vertx-mysql-client/src/main/asciidoc/index.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ Apart from configuring with a `MySQLConnectOptions` data object, We also provide
235235
{@link examples.MySQLClientExamples#configureFromUri(io.vertx.core.Vertx)}
236236
----
237237

238+
NOTE: Configuring parameters in connection URI will override the default properties.
239+
238240
More information about connection string formats can be found in the https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri[MySQL Reference Manual].
239241

240242
Currently, the client supports the following parameter keys (case-insensitive):
@@ -243,11 +245,12 @@ Currently, the client supports the following parameter keys (case-insensitive):
243245
* `port`
244246
* `user`
245247
* `password`
246-
* `schema`
247-
* `connection`
248-
* `useAffectedRows`
248+
* `schema` (database)
249+
* `useaffectedrows`
249250

250-
NOTE: Configuring parameters in connection URI will override the default properties.
251+
Additional parameters will be added to the {@link io.vertx.sqlclient.SqlConnectOptions#getProperties properties}.
252+
253+
NOTE: The connection URI parser transforms all property keys to lower case.
251254

252255
== Connect retries
253256

vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/MySQLConnectionUriParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ private static void parseAttributes(String attributesInfo, JsonObject configurat
177177
case "useaffectedrows":
178178
configuration.put("useAffectedRows", Boolean.parseBoolean(value));
179179
break;
180-
//TODO Additional Connection Parameters
181180
default:
182-
configuration.put(key, value);
181+
properties.put(key, value);
183182
break;
184183
}
185184
}

vertx-pg-client/src/main/asciidoc/index.adoc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ Apart from configuring with a `PgConnectOptions` data object, We also provide yo
181181
{@link examples.PgClientExamples#configureFromUri(io.vertx.core.Vertx)}
182182
----
183183

184+
NOTE: Configuring parameters in connection URI will override the default properties.
185+
184186
More information about connection string formats can be found in the https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-CONNSTRING[PostgreSQL Manuals].
185187

186188
Currently, the client supports the following parameter keys:
@@ -192,13 +194,10 @@ Currently, the client supports the following parameter keys:
192194
* `password`
193195
* `dbname`
194196
* `sslmode`
195-
* additional properties, including:
196-
** `application_name`
197-
** `fallback_application_name`
198-
** `search_path`
199-
** `options`
200197

201-
NOTE: Configuring parameters in connection URI will override the default properties.
198+
Additional parameters will be added to the {@link io.vertx.sqlclient.SqlConnectOptions#getProperties properties}.
199+
200+
NOTE: The connection URI parser transforms all property keys to lower case.
202201

203202
=== environment variables
204203

vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionUriParser.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,8 @@ private static void parseParameters(String parametersInfo, JsonObject configurat
185185
case "sslmode":
186186
configuration.put("sslMode", SslMode.of(value));
187187
break;
188-
case "application_name":
189-
properties.put("application_name", value);
190-
break;
191-
case "fallback_application_name":
192-
properties.put("fallback_application_name", value);
193-
break;
194-
case "search_path":
195-
properties.put("search_path", value);
196-
break;
197-
case "options":
198-
properties.put("options", value);
199-
break;
200188
default:
201-
configuration.put(key, value);
189+
properties.put(key, value);
202190
break;
203191
}
204192
}

0 commit comments

Comments
 (0)