@@ -22,84 +22,106 @@ public partial class MySqlConnectorDriver(
2222 public const string ByteCsvConverter = "ByteCsvConverter" ;
2323 public const string ByteArrayCsvConverter = "ByteArrayCsvConverter" ;
2424
25- protected override List < ColumnMapping > ColumnMappings { get ; } =
26- [
27- new ( "bool" ,
28- new Dictionary < string , DbTypeInfo >
29- {
30- { "tinyint" , new DbTypeInfo ( Length : 1 ) }
31- } , ordinal => $ "reader.GetBoolean({ ordinal } )") ,
32- new ( "short" ,
33- new Dictionary < string , DbTypeInfo >
34- {
35- { "tinyint" , new DbTypeInfo ( ) } ,
36- { "smallint" , new DbTypeInfo ( ) } ,
37- { "year" , new DbTypeInfo ( ) }
38- } , ordinal => $ "reader.GetInt16({ ordinal } )") ,
39- new ( "long" ,
40- new Dictionary < string , DbTypeInfo >
41- {
42- { "bigint" , new DbTypeInfo ( ) }
43- } , ordinal => $ "reader.GetInt64({ ordinal } )") ,
44- new ( "byte" ,
45- new Dictionary < string , DbTypeInfo >
46- {
47- { "bit" , new DbTypeInfo ( ) }
48- } , ordinal => $ "reader.GetFieldValue<byte>({ ordinal } )") ,
49- new ( "byte[]" ,
50- new Dictionary < string , DbTypeInfo >
51- {
52- { "binary" , new DbTypeInfo ( ) } ,
53- { "blob" , new DbTypeInfo ( ) } ,
54- { "longblob" , new DbTypeInfo ( ) } ,
55- { "mediumblob" , new DbTypeInfo ( ) } ,
56- { "tinyblob" , new DbTypeInfo ( ) } ,
57- { "varbinary" , new DbTypeInfo ( ) }
58- } , ordinal => $ "reader.GetFieldValue<byte[]>({ ordinal } )") ,
59- new ( "string" ,
60- new Dictionary < string , DbTypeInfo >
61- {
62- { "char" , new DbTypeInfo ( ) } ,
63- { "longtext" , new DbTypeInfo ( ) } ,
64- { "mediumtext" , new DbTypeInfo ( ) } ,
65- { "text" , new DbTypeInfo ( ) } ,
66- { "time" , new DbTypeInfo ( ) } ,
67- { "tinytext" , new DbTypeInfo ( ) } ,
68- { "varchar" , new DbTypeInfo ( ) } ,
69- { "var_string" , new DbTypeInfo ( ) } ,
70- { "json" , new DbTypeInfo ( ) } ,
71- } , ordinal => $ "reader.GetString({ ordinal } )") ,
72- new ( "DateTime" ,
73- new Dictionary < string , DbTypeInfo >
74- {
75- { "date" , new DbTypeInfo ( ) } ,
76- { "datetime" , new DbTypeInfo ( ) } ,
77- { "timestamp" , new DbTypeInfo ( ) }
78- } , ordinal => $ "reader.GetDateTime({ ordinal } )") ,
79- new ( "int" ,
80- new Dictionary < string , DbTypeInfo >
81- {
82- { "int" , new DbTypeInfo ( ) } ,
83- { "mediumint" , new DbTypeInfo ( ) } ,
84- } , ordinal => $ "reader.GetInt32({ ordinal } )") ,
85- new ( "double" ,
86- new Dictionary < string , DbTypeInfo >
87- {
88- { "double" , new DbTypeInfo ( ) } ,
89- { "float" , new DbTypeInfo ( ) }
90- } , ordinal => $ "reader.GetDouble({ ordinal } )") ,
91- new ( "decimal" ,
92- new Dictionary < string , DbTypeInfo >
93- {
94- { "decimal" , new DbTypeInfo ( ) }
95- } , ordinal => $ "reader.GetDecimal({ ordinal } )") ,
96- // last item in the dictionary - enforce TODO
97- new ( "object" ,
25+ protected override Dictionary < string , ColumnMapping > ColumnMappings { get ; } =
26+ new ( )
27+ {
28+ [ "bool" ] = new ColumnMapping (
29+ new Dictionary < string , DbTypeInfo >
30+ {
31+ { "tinyint" , new DbTypeInfo ( Length : 1 ) }
32+ } ,
33+ ordinal => $ "reader.GetBoolean({ ordinal } )"
34+ ) ,
35+ [ "short" ] = new ColumnMapping (
36+ new Dictionary < string , DbTypeInfo >
37+ {
38+ { "tinyint" , new DbTypeInfo ( ) } ,
39+ { "smallint" , new DbTypeInfo ( ) } ,
40+ { "year" , new DbTypeInfo ( ) }
41+ } ,
42+ ordinal => $ "reader.GetInt16({ ordinal } )"
43+ ) ,
44+ [ "long" ] = new ColumnMapping (
45+ new Dictionary < string , DbTypeInfo >
46+ {
47+ { "bigint" , new DbTypeInfo ( ) }
48+ } ,
49+ ordinal => $ "reader.GetInt64({ ordinal } )"
50+ ) ,
51+ [ "byte" ] = new ColumnMapping (
52+ new Dictionary < string , DbTypeInfo >
53+ {
54+ { "bit" , new DbTypeInfo ( ) }
55+ } ,
56+ ordinal => $ "reader.GetFieldValue<byte>({ ordinal } )"
57+ ) ,
58+ [ "byte[]" ] = new ColumnMapping (
59+ new Dictionary < string , DbTypeInfo >
60+ {
61+ { "binary" , new DbTypeInfo ( ) } ,
62+ { "blob" , new DbTypeInfo ( ) } ,
63+ { "longblob" , new DbTypeInfo ( ) } ,
64+ { "mediumblob" , new DbTypeInfo ( ) } ,
65+ { "tinyblob" , new DbTypeInfo ( ) } ,
66+ { "varbinary" , new DbTypeInfo ( ) }
67+ } ,
68+ ordinal => $ "reader.GetFieldValue<byte[]>({ ordinal } )"
69+ ) ,
70+ [ "string" ] = new ColumnMapping (
71+ new Dictionary < string , DbTypeInfo >
72+ {
73+ { "char" , new DbTypeInfo ( ) } ,
74+ { "longtext" , new DbTypeInfo ( ) } ,
75+ { "mediumtext" , new DbTypeInfo ( ) } ,
76+ { "text" , new DbTypeInfo ( ) } ,
77+ { "time" , new DbTypeInfo ( ) } ,
78+ { "tinytext" , new DbTypeInfo ( ) } ,
79+ { "varchar" , new DbTypeInfo ( ) } ,
80+ { "var_string" , new DbTypeInfo ( ) } ,
81+ { "json" , new DbTypeInfo ( ) }
82+ } ,
83+ ordinal => $ "reader.GetString({ ordinal } )"
84+ ) ,
85+ [ "DateTime" ] = new ColumnMapping (
86+ new Dictionary < string , DbTypeInfo >
87+ {
88+ { "date" , new DbTypeInfo ( ) } ,
89+ { "datetime" , new DbTypeInfo ( ) } ,
90+ { "timestamp" , new DbTypeInfo ( ) }
91+ } ,
92+ ordinal => $ "reader.GetDateTime({ ordinal } )"
93+ ) ,
94+ [ "int" ] = new ColumnMapping (
95+ new Dictionary < string , DbTypeInfo >
96+ {
97+ { "int" , new DbTypeInfo ( ) } ,
98+ { "mediumint" , new DbTypeInfo ( ) }
99+ } ,
100+ ordinal => $ "reader.GetInt32({ ordinal } )"
101+ ) ,
102+ [ "double" ] = new ColumnMapping (
103+ new Dictionary < string , DbTypeInfo >
104+ {
105+ { "double" , new DbTypeInfo ( ) } ,
106+ { "float" , new DbTypeInfo ( ) }
107+ } ,
108+ ordinal => $ "reader.GetDouble({ ordinal } )"
109+ ) ,
110+ [ "decimal" ] = new ColumnMapping (
111+ new Dictionary < string , DbTypeInfo >
112+ {
113+ { "decimal" , new DbTypeInfo ( ) }
114+ } ,
115+ ordinal => $ "reader.GetDecimal({ ordinal } )"
116+ ) ,
117+ [ "object" ] = new ColumnMapping (
98118 new Dictionary < string , DbTypeInfo >
99119 {
100120 { "any" , new DbTypeInfo ( ) }
101- } , ordinal => $ "reader.GetValue({ ordinal } )")
102- ] ;
121+ } ,
122+ ordinal => $ "reader.GetValue({ ordinal } )"
123+ )
124+ } ;
103125
104126 public override string TransactionClassName => "MySqlTransaction" ;
105127
0 commit comments