@@ -26,7 +26,7 @@ public sealed partial class MySqlConnectorDriver(
2626 {
2727 { "tinyint" , new ( Length : 1 ) }
2828 } ,
29- ordinal => $ "reader.GetBoolean({ ordinal } )"
29+ readerFn : ( ordinal , _ ) => $ "reader.GetBoolean({ ordinal } )"
3030 ) ,
3131 [ "short" ] = new (
3232 new ( )
@@ -35,7 +35,7 @@ public sealed partial class MySqlConnectorDriver(
3535 { "smallint" , new ( ) } ,
3636 { "year" , new ( ) }
3737 } ,
38- ordinal => $ "reader.GetInt16({ ordinal } )"
38+ readerFn : ( ordinal , _ ) => $ "reader.GetInt16({ ordinal } )"
3939 ) ,
4040 [ "int" ] = new (
4141 new ( )
@@ -44,15 +44,15 @@ public sealed partial class MySqlConnectorDriver(
4444 { "integer" , new ( ) } ,
4545 { "mediumint" , new ( ) }
4646 } ,
47- ordinal => $ "reader.GetInt32({ ordinal } )",
47+ readerFn : ( ordinal , _ ) => $ "reader.GetInt32({ ordinal } )",
4848 convertFunc : x => $ "Convert.ToInt32{ x } "
4949 ) ,
5050 [ "long" ] = new (
5151 new ( )
5252 {
5353 { "bigint" , new ( ) }
5454 } ,
55- ordinal => $ "reader.GetInt64({ ordinal } )",
55+ readerFn : ( ordinal , _ ) => $ "reader.GetInt64({ ordinal } )",
5656 convertFunc : x => $ "Convert.ToInt64{ x } "
5757 ) ,
5858 [ "double" ] = new (
@@ -61,14 +61,14 @@ public sealed partial class MySqlConnectorDriver(
6161 { "double" , new ( ) } ,
6262 { "float" , new ( ) }
6363 } ,
64- ordinal => $ "reader.GetDouble({ ordinal } )"
64+ readerFn : ( ordinal , _ ) => $ "reader.GetDouble({ ordinal } )"
6565 ) ,
6666 [ "decimal" ] = new (
6767 new ( )
6868 {
6969 { "decimal" , new ( ) }
7070 } ,
71- ordinal => $ "reader.GetDecimal({ ordinal } )"
71+ readerFn : ( ordinal , _ ) => $ "reader.GetDecimal({ ordinal } )"
7272 ) ,
7373
7474 /* Binary data types */
@@ -77,7 +77,7 @@ public sealed partial class MySqlConnectorDriver(
7777 {
7878 { "bit" , new ( ) }
7979 } ,
80- ordinal => $ "reader.GetFieldValue<byte>({ ordinal } )"
80+ readerFn : ( ordinal , _ ) => $ "reader.GetFieldValue<byte>({ ordinal } )"
8181 ) ,
8282 [ "byte[]" ] = new (
8383 new ( )
@@ -89,7 +89,7 @@ public sealed partial class MySqlConnectorDriver(
8989 { "tinyblob" , new ( ) } ,
9090 { "varbinary" , new ( ) }
9191 } ,
92- ordinal => $ "reader.GetFieldValue<byte[]>({ ordinal } )"
92+ readerFn : ( ordinal , _ ) => $ "reader.GetFieldValue<byte[]>({ ordinal } )"
9393 ) ,
9494
9595 /* String data types */
@@ -104,7 +104,7 @@ public sealed partial class MySqlConnectorDriver(
104104 { "varchar" , new ( ) } ,
105105 { "var_string" , new ( ) } ,
106106 } ,
107- ordinal => $ "reader.GetString({ ordinal } )"
107+ readerFn : ( ordinal , _ ) => $ "reader.GetString({ ordinal } )"
108108 ) ,
109109
110110 /* Date and time data types */
@@ -115,14 +115,14 @@ public sealed partial class MySqlConnectorDriver(
115115 { "datetime" , new ( ) } ,
116116 { "timestamp" , new ( ) }
117117 } ,
118- readerFn : ordinal => $ "reader.GetDateTime({ ordinal } )"
118+ readerFn : ( ordinal , _ ) => $ "reader.GetDateTime({ ordinal } )"
119119 ) ,
120120 [ "TimeSpan" ] = new (
121121 new ( )
122122 {
123123 { "time" , new ( ) }
124124 } ,
125- readerFn : ordinal => $ "reader.GetFieldValue<TimeSpan>({ ordinal } )"
125+ readerFn : ( ordinal , _ ) => $ "reader.GetFieldValue<TimeSpan>({ ordinal } )"
126126 ) ,
127127
128128 /* Unstructured data types */
@@ -131,8 +131,8 @@ public sealed partial class MySqlConnectorDriver(
131131 {
132132 { "json" , new ( ) }
133133 } ,
134- readerFn : ordinal => $ "JsonSerializer.Deserialize<JsonElement>(reader.GetString({ ordinal } ))",
135- writerFn : ( el , notNull , isDapper ) =>
134+ readerFn : ( ordinal , _ ) => $ "JsonSerializer.Deserialize<JsonElement>(reader.GetString({ ordinal } ))",
135+ writerFn : ( el , _ , notNull , isDapper , isLegacy ) =>
136136 {
137137 if ( notNull )
138138 return $ "{ el } .GetRawText()";
@@ -150,7 +150,7 @@ public sealed partial class MySqlConnectorDriver(
150150 {
151151 { "any" , new ( ) }
152152 } ,
153- ordinal => $ "reader.GetValue({ ordinal } )"
153+ readerFn : ( ordinal , _ ) => $ "reader.GetValue({ ordinal } )"
154154 )
155155 } ;
156156
@@ -621,7 +621,7 @@ private bool IsSetDataType(Column column)
621621 return writerFn ;
622622
623623 if ( GetEnumType ( column ) is { } enumType && IsSetDataType ( column , enumType ) )
624- return ( el , notNull , isDapper ) =>
624+ return ( el , dbType , notNull , isDapper , isLegacy ) =>
625625 {
626626 var stringJoinStmt = $ "string.Join(\" ,\" , { el } )";
627627 var nullValue = isDapper ? "null" : "(object)DBNull.Value" ;
@@ -630,7 +630,7 @@ private bool IsSetDataType(Column column)
630630 : $ "{ el } != null ? { stringJoinStmt } : { nullValue } ";
631631 } ;
632632
633- static string DefaultWriterFn ( string el , bool notNull , bool isDapper ) => notNull ? el : $ "{ el } ?? (object)DBNull.Value";
633+ static string DefaultWriterFn ( string el , string dbType , bool notNull , bool isDapper , bool isLegacy ) => notNull ? el : $ "{ el } ?? (object)DBNull.Value";
634634 return Options . UseDapper ? null : DefaultWriterFn ;
635635 }
636636
0 commit comments