gpt4 book ai didi

.net - Sqlite 数据类型映射到 .net (CLR) 框架数据类型

转载 作者:行者123 更新时间:2023-12-03 17:05:25 25 4
gpt4 key购买 nike

谁能给我一些关于从 Sqlite 到 .net (CLR) 框架的数据类型映射的真实信息。

问候

乌梅尔

最佳答案

SQLite 有点奇怪(对于数据库而言),因为它使用动态类型系统。类型与数据相关联,而不是与列相关联。

From SQLite website:

Data types supported by SQLite are:

NULL. The value is a NULL value.

INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8

bytes depending on the magnitude of the value.

REAL. The value is a floating point value, stored as an 8-byte IEEE

floating point number.

TEXT. The value is a text string, stored using the database encoding

(UTF-8, UTF-16BE or UTF-16LE).

BLOB. The value is a blob of data, stored exactly as it was input.

甚至日期也存储为这些类型之一:

1.2 Date and Time Datatype

SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:

TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
REAL as Julian day numbers, the number of days since noon in Greenwich

on November 24, 4714 B.C. according to the proleptic Gregorian calendar. INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.

Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions.


因此,SQLite 将数据与这 5 种类型中的一种(包括 NULL)相关联,并且应用程序负责将数据解释为更具体的内容(例如,在 .NET 的情况下,将 TEXT 转换为 DateTime)。

关于.net - Sqlite 数据类型映射到 .net (CLR) 框架数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5368515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com