Documentation Source Text

Check-in [e89c80cd7d]
Login

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

Overview
Comment:Fix a typo in datatype3.html and add a new bullet to clarify the affinity for the RHS of an IN or NOT IN operator.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e89c80cd7d60e08c7b0df8d95fdc2529be07f9c8
User & Date: drh 2014-06-26 21:05:47.581
Context
2014-06-27
20:49
Clarifications to the FTS4 languageid documentation. (check-in: 0a22af73df user: drh tags: trunk)
2014-06-26
21:05
Fix a typo in datatype3.html and add a new bullet to clarify the affinity for the RHS of an IN or NOT IN operator. (check-in: e89c80cd7d user: drh tags: trunk)
2014-06-16
15:11
Update the ".help" screen capture in the "cli.html" document to show the ".eqp" command. (check-in: c4d6ba9b0c user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to pages/datatype3.in.
334
335
336
337
338
339
340




341
342
343
344
345
346
347
<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 affinity of the operands.
Operand affinity is determined by the following rules:

<ul>




  <li><p>^An expression that is a simple reference to a column value
  has the same affinity as the column.
  ^(Note that if X and Y.Z 
  are column names, then +X and +Y.Z are considered expressions for the
  purpose of determining affinity.)^</p>

  <li><p>^(An expression of the form "CAST(<i>expr</i> AS <i>type</i>)"







>
>
>
>







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<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 affinity of the operands.
Operand affinity is determined by the following rules:

<ul>
  <li><p>^The affinity of the right-hand operand of an IN or NOT IN
  operator is NONE if the operand is a list and is the same as the
  affinity of the result set expression if the operand is a SELECT.

  <li><p>^An expression that is a simple reference to a column value
  has the same affinity as the column.
  ^(Note that if X and Y.Z 
  are column names, then +X and +Y.Z are considered expressions for the
  purpose of determining affinity.)^</p>

  <li><p>^(An expression of the form "CAST(<i>expr</i> AS <i>type</i>)"
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<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 as TEXT or NONE affinity
then NUMERIC affinity is applied to other operand.

<li><p>^If one operand has TEXT affinity and the other has NONE affinity,
then TEXT affinity is applied to the other operand.

<li><p>^Otherwise, no affinity is applied and both operands are compared
as is.</p>







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<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 NONE affinity
then NUMERIC affinity is applied to other operand.

<li><p>^If one operand has TEXT affinity and the other has NONE affinity,
then TEXT affinity is applied to the other operand.

<li><p>^Otherwise, no affinity is applied and both operands are compared
as is.</p>