Documentation Source Text

Check-in [3a3335a61e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Further clarification of automatic affinity conversion rules.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3a3335a61eef722632c31a665b0679a672f1fc90c189100e2c4ea47db22d5792
User & Date: drh 2019-10-14 00:26:59
Context
2019-10-16
18:07
Fix typos in the lemon documentation. check-in: 85bc3983a5 user: drh tags: trunk
2019-10-14
00:26
Further clarification of automatic affinity conversion rules. check-in: 3a3335a61e user: drh tags: trunk
00:20
Clarification of the automatic conversion rules for inserting TEXT into a NUMERIC column. check-in: 9840457b31 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/datatype3.in.

432
433
434
435
436
437
438
439







440
441
442
443
444
445
446
447

<p>^SQLite may attempt to convert values between the storage classes
INTEGER, REAL, and/or TEXT before performing a comparison.
^Whether or not any conversions are attempted before the comparison takes
place depends on the type affinity of the operands.

<p>To "apply affinity" means to convert an operand to a particular storage
class if and only if the conversion is lossless and reversible.







^(Affinity is applied to operands of a comparison operator prior to
the comparison according to the following rules in the order shown:)^</p>

<ul>
<li><p>^If one operand has INTEGER, REAL or NUMERIC affinity
and the other operand has TEXT or BLOB or no affinity
then NUMERIC affinity is applied to other operand.








|
>
>
>
>
>
>
>
|







432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454

<p>^SQLite may attempt to convert values between the storage classes
INTEGER, REAL, and/or TEXT before performing a comparison.
^Whether or not any conversions are attempted before the comparison takes
place depends on the type affinity of the operands.

<p>To "apply affinity" means to convert an operand to a particular storage
class if and only if the conversion does not lose essential information.
Numeric values can always be converted into TEXT.  TEXT values 
can be converted into numeric values if the text content is a well-formed 
integer or real literal, but not a hexadecimal integer literal.
BLOB values are converted into TEXT values by simply interpreting
the binary BLOB context as a text string in the current database
encoding.

<p>^(Affinity is applied to operands of a comparison operator prior to
the comparison according to the following rules in the order shown:)^</p>

<ul>
<li><p>^If one operand has INTEGER, REAL or NUMERIC affinity
and the other operand has TEXT or BLOB or no affinity
then NUMERIC affinity is applied to other operand.