fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

Handle "Views" in SQLite schema #618

Closed iNecas closed 5 years ago

iNecas commented 5 years ago

Without this patch, I was getting the following error:

error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider'
reported an error: Not supported. This custom getSchema will be removed
when the corresponding System.Data.Common interface is supported by
the connection driver.

It turned out the customGetSchema method was not counting on "Views" in name variable. This patch should support this by splitting current handler for "Tables", that seemed to handle both tables and views in the past.

This patch also enhances the error message, so that next time, it would include the name of the unsupported field right in the message, like this:

error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider'
reported an error: Not supported [ Views ].
# ...
iNecas commented 5 years ago

An example app reproducing the issue, as well as proving the patch fixing it, can be found here https://github.com/iNecas/fsharp-sqlite

iNecas commented 5 years ago

SRY for whitespace changes, I'm ok with removing those if necessary (although would prefer cleaning up the training spaces)

Thorium commented 5 years ago

Thanks!

Thorium commented 5 years ago

Released in Nuget package 1.1.64

iNecas commented 5 years ago

Thanks @Thorium!