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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/datatype3.in.

   432    432   
   433    433   <p>^SQLite may attempt to convert values between the storage classes
   434    434   INTEGER, REAL, and/or TEXT before performing a comparison.
   435    435   ^Whether or not any conversions are attempted before the comparison takes
   436    436   place depends on the type affinity of the operands.
   437    437   
   438    438   <p>To "apply affinity" means to convert an operand to a particular storage
   439         -class if and only if the conversion is lossless and reversible.
   440         -^(Affinity is applied to operands of a comparison operator prior to
          439  +class if and only if the conversion does not lose essential information.
          440  +Numeric values can always be converted into TEXT.  TEXT values 
          441  +can be converted into numeric values if the text content is a well-formed 
          442  +integer or real literal, but not a hexadecimal integer literal.
          443  +BLOB values are converted into TEXT values by simply interpreting
          444  +the binary BLOB context as a text string in the current database
          445  +encoding.
          446  +
          447  +<p>^(Affinity is applied to operands of a comparison operator prior to
   441    448   the comparison according to the following rules in the order shown:)^</p>
   442    449   
   443    450   <ul>
   444    451   <li><p>^If one operand has INTEGER, REAL or NUMERIC affinity
   445    452   and the other operand has TEXT or BLOB or no affinity
   446    453   then NUMERIC affinity is applied to other operand.
   447    454