@@ -635,6 +635,45 @@ public async Task BulkCopyNullDataReader()
635635 var bulkCopy = new MySqlBulkCopy ( connection ) ;
636636 await Assert . ThrowsAsync < ArgumentNullException > ( async ( ) => await bulkCopy . WriteToServerAsync ( default ( DbDataReader ) ) ) ;
637637 }
638+ 639+ [ Fact ]
640+ public async Task BulkCopyGeometryAsync ( )
641+ {
642+ var dataTable = new DataTable ( )
643+ {
644+ Columns =
645+ {
646+ new DataColumn ( "geo_data" , typeof ( MySqlGeometry ) ) ,
647+ } ,
648+ Rows =
649+ {
650+ new object [ ] { MySqlGeometry . FromWkb ( 0 , [ 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 240 , 63 , 0 , 0 , 0 , 0 , 0 , 0 , 240 , 63 ] ) } ,
651+ } ,
652+ } ;
653+ 654+ using var connection = new MySqlConnection ( GetLocalConnectionString ( ) ) ;
655+ await connection . OpenAsync ( ) ;
656+ using ( var cmd = new MySqlCommand ( @"drop table if exists bulk_load_data_table;
657+ create table bulk_load_data_table(id BIGINT UNIQUE NOT NULL AUTO_INCREMENT, geo_data GEOMETRY NOT NULL);" , connection ) )
658+ {
659+ await cmd . ExecuteNonQueryAsync ( ) ;
660+ }
661+ 662+ var bc = new MySqlBulkCopy ( connection )
663+ {
664+ DestinationTableName = "bulk_load_data_table" ,
665+ ColumnMappings =
666+ {
667+ new ( )
668+ {
669+ SourceOrdinal = 0 ,
670+ DestinationColumn = "geo_data" ,
671+ } ,
672+ } ,
673+ } ;
674+ 675+ await bc . WriteToServerAsync ( dataTable ) ;
676+ }
638677#endif
639678
640679 private static string GetConnectionString ( ) => BulkLoaderSync . GetConnectionString ( ) ;
0 commit comments