Giorgi / DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
https://duckdb.net
MIT License
343 stars 62 forks source link

DuckDBDataReader.cs does not implement GetSchemaTable() method that causes DataTable.Loader(IDataReader) and Dapper's Query() method fail #65

Closed erisonliang closed 1 year ago

erisonliang commented 1 year ago

Please add the followings to fix the issue. Thank you so much. (ref: https://github.com/mgravell/fast-member/blob/e7423b71d98fc0dd1d3a6eebf425fd987d5da56e/FastMember/ObjectReader.cs#L111)

public override DataTable GetSchemaTable() { // these are the columns used by DataTable load DataTable table = new DataTable { Columns = { {"ColumnOrdinal", typeof(int)}, {"ColumnName", typeof(string)}, {"DataType", typeof(Type)}, {"ColumnSize", typeof(int)}, {"AllowDBNull", typeof(bool)} } }; object[] rowData = new object[5]; for (int i = 0; i < FieldCount; i++) { rowData[0] = i; rowData[1] = GetName(i); rowData[2] = GetFieldType(i); rowData[3] = -1; rowData[4] = true; table.Rows.Add(rowData); } return table; }

Giorgi commented 1 year ago

@erisonliang Want to send a PR?

erisonliang commented 1 year ago

@erisonliang Want to send a PR?

Yes. Please.

mikeTWC1984 commented 1 year ago

I was looking for this feature too. Was the PR send/merged yet?

Giorgi commented 1 year ago

No, there is no PR for this feature.

mikeTWC1984 commented 1 year ago

Ok, just submitted one.

Giorgi commented 1 year ago

Implemented in #73. Thanks @mikeTWC1984