F#SQLProvider SQLite忽略了列类型

时间:2016-12-01 12:57:10

标签: sqlite f# type-providers

类型提供程序似乎没有将所有数据类型添加到可用类型列表中:整数和文本工作正常,但忽略varchar或具有指定长度的int(而没有长度规范的VARCHAR工作正常)。

这是“正常”(是否有修改设置)? (例如,Mysql sql脚本似乎包含varchar大小限制)

#r @"..\packages\SQLProvider.1.0.37\lib\FSharp.Data.SqlProvider.dll"

open FSharp.Data.Sql

let [<Literal>] resolutionPath = __SOURCE_DIRECTORY__ + @"\..\packages\System.Data.SQLite.Core.1.0.103\lib\net45" 
let [<Literal>] connectionString = "Data Source=" + __SOURCE_DIRECTORY__ + @"\northwindEF.db; Version=3; foreign keys=true"
// create a type alias with the connection string and database vendor settings
type sql = SqlDataProvider< 
              ConnectionString = connectionString,
              DatabaseVendor = Common.DatabaseProviderTypes.SQLITE,
              SQLiteLibrary = Common.SQLiteLibrary.AutoSelect,
              ResolutionPath = resolutionPath,
              IndividualsAmount = 1000,
              UseOptionTypes = true, 
              CaseSensitivityChange = Common.CaseSensitivityChange.ORIGINAL>
let db = sql.GetDataContext()

for x in db.Main.Country do
  printfn "%A" x. //columns are ignored depending on their type

我的国家/地区表格具有以下结构:

CREATE TABLE country (
    id            INTEGER       PRIMARY KEY AUTOINCREMENT
                                NOT NULL,
    name          VARCHAR (255) NOT NULL,
    area_id       INTEGER,
    local_currency_id   INTEGER,
    comments      TEXT,
    numeric_code  INTEGER (3)   UNIQUE,
    alpha2_code   VARCHAR (2)   UNIQUE,
    alpha3_code   VARCHAR (3)   UNIQUE,
    svg_data_url  TEXT
);

1 个答案:

答案 0 :(得分:0)

它似乎来自SQLite类型提供程序代码,其中varchar和(255)之间的空格阻止了映射查找。

我已经与代码维护者联系。