Each value is stored as the type provided, with no attempt to convert anything. None: A column with a none affinity has no preference over storage class.Real: A column with REAL affinity behaves like a column with NUMERIC affinity except that it forces integer values into floating point representation.The only difference is that any value with a float type that lacks a fractional component will be converted into an integer type. Integer: A column with an integer affinity works essentially the same as a numeric affinity.If the conversion fails, the text value is stored without any type of conversion. Assuming the conversion works, the value is stored in an appropriate numeric type. Any time a value with a text type is stored, an attempt is made to convert the value to a numeric type (integer or float). Values with integer and float types, along with NULL and BLOB types, are stored without conversion. Numeric: A column with a numeric affinity will store any of the five types.If you attempt to store a value with a numeric type (float or integer) it will be converted into a text representation before being stored as a text value type. Text: A column with a text affinity will only store values of type NULL, text, or BLOB.Generally, type affinity will cause conversion or migration of types only if it can be done without losing data or precision.Įach table column must have one of five type affinities: Each type affinity has specific rules about what types of values it can store, and how different values will be converted when stored in that column. This is known as type affinity, and essentially represents a desired category of type. Rather than being an absolute type,like most databases, an SQLite column type (as defined in CREATE TABLE) becomes more of a suggestion than a hard and fast rule. The elements of most columns can hold any value type, the "type" of a column could be misleading. The maximum value for this directive is two gigabytes. The default limit is exactly one billion bytes, or slightly less than a full gigabyte. The maximum size of a text or BLOB value is limited by a compile-time directive. SQLite text and BLOB values are always variable length. For example, the notation x'1234ABCD' represents a 4-byte BLOB. Literal BLOBs are represented as hexadecimal text strings preceded by an x. BLOB: A length of raw bytes, copied exactly as provided.Literal text values are represented using character strings in single quotes. Text: A variable-length string, stored using the database encoding (UTF-8, UTF-16BE, or UTF-16LE).Literal floating-point numbers are represented by any bare series of numeric digits that include a decimal point or exponent. For most modern processors, this is an IEEE 754 double-precision number. REAL: The value is a floating-point number, stored as an 8-byte value in the processor's native format.Literal integers are represented by any bare series of numeric digits (without commas) that does not include a decimal point or exponent. Integer values are variable length, being 1, 2, 3, 4, 6, or 8 bytes in length, depending on the minimum size required to hold the specific value. Literal NULLs are represented by the keyword NULL. NULL: NULL is considered its own distinct type. These are known as storage classes, and represent the different ways SQLite stores data on disk.Įvery value has one of these five native storage classes: In the strictest sense, SQLite supports only five concrete datatypes. This allows nearly any element of any row to hold almost any type of value. For each row value, manifest typing records the value's type along with the value data. SQLite utilizes a dynamic typing technique known as manifest typing. Most databases use strong, static column typing which means that the elements of a column can only hold values compatible with the defined type of a column.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |