@@ -6,8 +6,7 @@ import org.jetbrains.exposed.sql.*
66import  org.jetbrains.exposed.sql.transactions.TransactionManager 
77import  java.math.BigDecimal 
88
9- internal  object  MysqlDataTypeProvider : DataTypeProvider() {
10- 
9+ internal  open  class  MysqlDataTypeProvider  : DataTypeProvider () {
1110    override  fun  binaryType (): String  {
1211        exposedLogger.error(" The length of the Binary column is missing."  )
1312        error(" The length of the Binary column is missing."  )
@@ -19,11 +18,7 @@ internal object MysqlDataTypeProvider : DataTypeProvider() {
1918        if  ((currentDialect as ?  MysqlDialect )?.isTimeZoneOffsetSupported() ==  true ) {
2019            " TIMESTAMP(6)" 
2120        } else  {
22-             throw  UnsupportedByDialectException (
23-                 " This vendor does not support timestamp with time zone data type"   + 
24-                     ((currentDialect as ?  MariaDBDialect )?.let  { " "   } ? :  "  for this version"  ),
25-                 currentDialect
26-             )
21+             throw  UnsupportedByDialectException (" This vendor does not support timestamp with time zone data type for this version"  , currentDialect)
2722        }
2823
2924    override  fun  ubyteType (): String  =  " TINYINT UNSIGNED" 
@@ -56,14 +51,12 @@ internal object MysqlDataTypeProvider : DataTypeProvider() {
5651
5752    override  fun  processForDefaultValue (e :  Expression <* >): String  =  when  {
5853        e is  LiteralOp <* > &&  e.columnType is  JsonColumnMarker  ->  when  {
59-             currentDialect is  MariaDBDialect  ->  super .processForDefaultValue(e)
6054            ((currentDialect as ?  MysqlDialect )?.fullVersion ? :  " 0"  ) >=  " 8.0.13"   ->  " (${super .processForDefaultValue(e)} )" 
6155            else  ->  throw  UnsupportedByDialectException (
6256                " MySQL versions prior to 8.0.13 do not accept default values on JSON columns"  ,
6357                currentDialect
6458            )
6559        }
66-         currentDialect is  MariaDBDialect  ->  super .processForDefaultValue(e)
6760        //  The default value specified in a DEFAULT clause can be a literal constant or an expression. With one
6861        //  exception, enclose expression default values within parentheses to distinguish them from literal constant
6962        //  default values. The exception is that, for TIMESTAMP and DATETIME columns, you can specify the
@@ -91,11 +84,13 @@ internal object MysqlDataTypeProvider : DataTypeProvider() {
9184    }
9285
9386    override  fun  hexToDb (hexString :  String ): String  =  " 0x$hexString " 
87+ 
88+     companion  object  {
89+         internal  val  INSTANCE  =  MysqlDataTypeProvider ()
90+     }
9491}
9592
9693internal  open  class  MysqlFunctionProvider  : FunctionProvider () {
97-     internal  object  INSTANCE : MysqlFunctionProvider()
98- 
9994    override  fun  random (seed :  Int? ): String  =  " RAND(${seed?.toString().orEmpty()} )" 
10095
10196    private  class  MATCH (val  expr :  Expression <* >, val  pattern :  String , val  mode :  MatchMode ) : Op<Boolean>() {
@@ -314,8 +309,8 @@ internal open class MysqlFunctionProvider : FunctionProvider() {
314309        }
315310    }
316311
317-     private  fun  isUpsertAliasSupported (dialect :  DatabaseDialect ): Boolean  =  when  (dialect) {
318-         is  MysqlDialect  ->  dialect  !is   MariaDBDialect   &&  dialect .fullVersion >=  " 8.0.19" 
312+     open  fun  isUpsertAliasSupported (dialect :  DatabaseDialect ): Boolean  =  when  (dialect) {
313+         is  MysqlDialect  ->  dialect.fullVersion >=  " 8.0.19" 
319314        else  ->  false  //  H2_MySQL mode also uses this function provider & requires older unsupported version
320315    }
321316
@@ -331,12 +326,16 @@ internal open class MysqlFunctionProvider : FunctionProvider() {
331326        }
332327        return  super .queryLimitAndOffset(size, offset, alreadyOrdered)
333328    }
329+ 
330+     companion  object  {
331+         internal  val  INSTANCE  =  MysqlFunctionProvider ()
332+     }
334333}
335334
336335/* *
337336 * MySQL dialect implementation. 
338337 */  
339- open  class  MysqlDialect  : VendorDialect (dialectName, MysqlDataTypeProvider , MysqlFunctionProvider .INSTANCE ) {
338+ open  class  MysqlDialect  : VendorDialect (dialectName, MysqlDataTypeProvider . INSTANCE , MysqlFunctionProvider .INSTANCE ) {
340339
341340    internal  val  isMysql8:  Boolean  by lazy {
342341        TransactionManager .current().db.isVersionCovers(BigDecimal (" 8.0"  ))
@@ -361,13 +360,13 @@ open class MysqlDialect : VendorDialect(dialectName, MysqlDataTypeProvider, Mysq
361360    open  fun  isFractionDateTimeSupported (): Boolean  =  TransactionManager .current().db.isVersionCovers(5 , 6 )
362361
363362    /* * Returns `true` if a MySQL database is being used and its version is greater than or equal to 8.0. */ 
364-     fun  isTimeZoneOffsetSupported (): Boolean  =  (currentDialect  !is   MariaDBDialect )  &&  isMysql8
363+     open   fun  isTimeZoneOffsetSupported (): Boolean  =  isMysql8
365364
366-     private  val  notAcceptableDefaults =  mutableListOf (" CURRENT_DATE()"  , " CURRENT_DATE"  )
365+     protected  val  notAcceptableDefaults =  mutableListOf (" CURRENT_DATE()"  , " CURRENT_DATE"  )
367366
368367    override  fun  isAllowedAsColumnDefault (e :  Expression <* >): Boolean  {
369368        if  (super .isAllowedAsColumnDefault(e)) return  true 
370-         if  ((currentDialect  is   MariaDBDialect   &&   fullVersion >=  " 10.2.1 " )  ||  (currentDialect  !is   MariaDBDialect   &&  fullVersion  >=   " 8.0.13" ) ) {
369+         if  (fullVersion >=  " 8.0.13"  ) {
371370            return  true 
372371        }
373372
0 commit comments