@@ -134,24 +134,26 @@ public final class MySqlConnectionConfiguration {
134
134
135
135
private final boolean metrics ;
136
136
137
+ private final boolean tinyInt1isBit ;
138
+
137
139
private MySqlConnectionConfiguration (
138
- boolean isHost , String domain , int port , MySqlSslConfiguration ssl ,
139
- boolean tcpKeepAlive , boolean tcpNoDelay , @ Nullable Duration connectTimeout ,
140
- ZeroDateOption zeroDateOption ,
141
- boolean preserveInstants ,
142
- String connectionTimeZone ,
143
- boolean forceConnectionTimeZoneToSession ,
144
- String user , @ Nullable CharSequence password , @ Nullable String database ,
145
- boolean createDatabaseIfNotExist , @ Nullable Predicate <String > preferPrepareStatement ,
146
- List <String > sessionVariables , @ Nullable Duration lockWaitTimeout , @ Nullable Duration statementTimeout ,
147
- @ Nullable Path loadLocalInfilePath , int localInfileBufferSize ,
148
- int queryCacheSize , int prepareCacheSize ,
149
- Set <CompressionAlgorithm > compressionAlgorithms , int zstdCompressionLevel ,
150
- @ Nullable LoopResources loopResources ,
151
- Extensions extensions , @ Nullable Publisher <String > passwordPublisher ,
152
- @ Nullable AddressResolverGroup <?> resolver ,
153
- boolean metrics
154
- ) {
140
+ boolean isHost , String domain , int port , MySqlSslConfiguration ssl ,
141
+ boolean tcpKeepAlive , boolean tcpNoDelay , @ Nullable Duration connectTimeout ,
142
+ ZeroDateOption zeroDateOption ,
143
+ boolean preserveInstants ,
144
+ String connectionTimeZone ,
145
+ boolean forceConnectionTimeZoneToSession ,
146
+ String user , @ Nullable CharSequence password , @ Nullable String database ,
147
+ boolean createDatabaseIfNotExist , @ Nullable Predicate <String > preferPrepareStatement ,
148
+ List <String > sessionVariables , @ Nullable Duration lockWaitTimeout , @ Nullable Duration statementTimeout ,
149
+ @ Nullable Path loadLocalInfilePath , int localInfileBufferSize ,
150
+ int queryCacheSize , int prepareCacheSize ,
151
+ Set <CompressionAlgorithm > compressionAlgorithms , int zstdCompressionLevel ,
152
+ @ Nullable LoopResources loopResources ,
153
+ Extensions extensions , @ Nullable Publisher <String > passwordPublisher ,
154
+ @ Nullable AddressResolverGroup <?> resolver ,
155
+ boolean metrics ,
156
+ boolean tinyInt1isBit ) {
155
157
this .isHost = isHost ;
156
158
this .domain = domain ;
157
159
this .port = port ;
@@ -182,6 +184,7 @@ private MySqlConnectionConfiguration(
182
184
this .passwordPublisher = passwordPublisher ;
183
185
this .resolver = resolver ;
184
186
this .metrics = metrics ;
187
+ this .tinyInt1isBit = tinyInt1isBit ;
185
188
}
186
189
187
190
/**
@@ -321,6 +324,10 @@ boolean isMetrics() {
321
324
return metrics ;
322
325
}
323
326
327
+ boolean isTinyInt1isBit () {
328
+ return tinyInt1isBit ;
329
+ }
330
+
324
331
@ Override
325
332
public boolean equals (Object o ) {
326
333
if (this == o ) {
@@ -359,7 +366,8 @@ public boolean equals(Object o) {
359
366
extensions .equals (that .extensions ) &&
360
367
Objects .equals (passwordPublisher , that .passwordPublisher ) &&
361
368
Objects .equals (resolver , that .resolver ) &&
362
- metrics == that .metrics ;
369
+ metrics == that .metrics &&
370
+ tinyInt1isBit == that .tinyInt1isBit ;
363
371
}
364
372
365
373
@ Override
@@ -374,7 +382,7 @@ public int hashCode() {
374
382
loadLocalInfilePath , localInfileBufferSize ,
375
383
queryCacheSize , prepareCacheSize ,
376
384
compressionAlgorithms , zstdCompressionLevel ,
377
- loopResources , extensions , passwordPublisher , resolver , metrics );
385
+ loopResources , extensions , passwordPublisher , resolver , metrics , tinyInt1isBit );
378
386
}
379
387
380
388
@ Override
@@ -409,7 +417,8 @@ private String buildCommonToStringPart() {
409
417
", extensions=" + extensions +
410
418
", passwordPublisher=" + passwordPublisher +
411
419
", resolver=" + resolver +
412
- ", metrics=" + metrics ;
420
+ ", metrics=" + metrics +
421
+ ", tinyint1isBit=" + tinyInt1isBit ;
413
422
}
414
423
415
424
/**
@@ -511,6 +520,8 @@ public static final class Builder {
511
520
512
521
private boolean metrics ;
513
522
523
+ private boolean tinyInt1isBit = true ;
524
+
514
525
/**
515
526
* Builds an immutable {@link MySqlConnectionConfiguration} with current options.
516
527
*
@@ -545,11 +556,11 @@ public MySqlConnectionConfiguration build() {
545
556
loadLocalInfilePath ,
546
557
localInfileBufferSize , queryCacheSize , prepareCacheSize ,
547
558
compressionAlgorithms , zstdCompressionLevel , loopResources ,
548
- Extensions .from (extensions , autodetectExtensions ), passwordPublisher , resolver , metrics );
559
+ Extensions .from (extensions , autodetectExtensions ), passwordPublisher , resolver , metrics , tinyInt1isBit );
549
560
}
550
561
551
562
/**
552
- * Configures the database. Default no database.
563
+ * Configures the database. Default no database.
553
564
*
554
565
* @param database the database, or {@code null} if no database want to be login.
555
566
* @return this {@link Builder}.
@@ -1207,6 +1218,20 @@ public Builder metrics(boolean enabled) {
1207
1218
return this ;
1208
1219
}
1209
1220
1221
+ /**
1222
+ * Option to whether the driver should interpret MySQL's TINYINT(1) as a BIT type.
1223
+ * When enabled, TINYINT(1) columns (both SIGNED and UNSIGNED) will be treated as
1224
+ * BIT. default to {@code true}.
1225
+ *
1226
+ * @param tinyInt1isBit {@code true} to treat TINYINT(1) as BIT
1227
+ * @return this {@link Builder}
1228
+ * @since 1.4.0
1229
+ */
1230
+ public Builder tinyInt1isBit (boolean tinyInt1isBit ) {
1231
+ this .tinyInt1isBit = tinyInt1isBit ;
1232
+ return this ;
1233
+ }
1234
+
1210
1235
private SslMode requireSslMode () {
1211
1236
SslMode sslMode = this .sslMode ;
1212
1237
0 commit comments