Documentation Source Text

Check-in [47550c82de]
Login

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

Overview
Comment:Update the description of the content= option in fts5.html.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 47550c82ded19191779a96e38b0792ea4e5c3bd0
User & Date: dan 2015-04-27 16:42:13
Context
2015-04-30
13:26
Clarifications to howtocompile.html and testing.html. check-in: 81a7294781 user: drh tags: trunk
2015-04-27
16:42
Update the description of the content= option in fts5.html. check-in: 47550c82de user: dan tags: trunk
2015-04-25
18:17
Add discussion of the AFL fuzzer to the testing document. check-in: 34e2a86993 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/fts5.in.

592
593
594
595
596
597
598
599
600
601
602
603
604
605

606
607
608
609






610
611
612
613
614
615
616
617
618
619
620
621
622
<p> An external content FTS5 table is created by setting the content 
option to the name of a table, virtual table or view (hereafter the "content
table") within the same database. Whenever column values are required by
FTS5, it queries the content table as follows, with the rowid of the row
for which values are required bound to the SQL variable:

<codeblock>
  SELECT * FROM &lt;content&gt; WHERE &lt;content_rowid&gt; = ?;
</codeblock>

<p> In the above, &lt;content&gt; is replaced by the name of the content table.
By default, &lt;content_rowid&gt; is replaced by the literal text "rowid". Or,
if the "content_rowid" option is set within the CREATE VIRTUAL TABLE statement,
by the value of that option.


<p> The "*" in the above query must expand to a set of columns consisting of
the &lt;column_rowid&gt; column followed by each indexed column, in the same
order as they are present in the external content fts5 table.







<p> The content table may also be queried as follows:

<codeblock>
  SELECT * FROM &lt;content&gt; ORDER BY &lt;content_rowid&gt; ASC;
  SELECT * FROM &lt;content&gt; ORDER BY &lt;content_rowid&gt; DESC;
</codeblock>

<p> It is still the responsibility of the user to ensure that the contents of
an external content FTS5 table are kept up to date with the content table. 
One way to do this is with triggers. For example:

<codeblock>







|





|
>

<
|
|
>
>
>
>
>
>




|
|







592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607

608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
<p> An external content FTS5 table is created by setting the content 
option to the name of a table, virtual table or view (hereafter the "content
table") within the same database. Whenever column values are required by
FTS5, it queries the content table as follows, with the rowid of the row
for which values are required bound to the SQL variable:

<codeblock>
  SELECT &lt;content_rowid&gt;, &lt;cols&gt; FROM &lt;content&gt; WHERE &lt;content_rowid&gt; = ?;
</codeblock>

<p> In the above, &lt;content&gt; is replaced by the name of the content table.
By default, &lt;content_rowid&gt; is replaced by the literal text "rowid". Or,
if the "content_rowid" option is set within the CREATE VIRTUAL TABLE statement,
by the value of that option. &lt;cols&gt; is replaced by a comma-separated list
of the FTS5 table column names. For example:


<codeblock>
  <i>-- If the database schema is: </i>
  CREATE TABLE tbl (a, b, c, d INTEGER PRIMARY KEY);
  CREATE TABLE fts USING fts5(a, c, content=tbl, content_rowid=d);

  <i>-- Fts5 may issue queries such as:</i>
  SELECT d, a, c FROM tbl WHERE d = ?;
</codeblock>

<p> The content table may also be queried as follows:

<codeblock>
  SELECT &lt;content_rowid&gt;, &lt;cols&gt; FROM &lt;content&gt; ORDER BY &lt;content_rowid&gt; ASC;
  SELECT &lt;content_rowid&gt;, &lt;cols&gt; FROM &lt;content&gt; ORDER BY &lt;content_rowid&gt; DESC;
</codeblock>

<p> It is still the responsibility of the user to ensure that the contents of
an external content FTS5 table are kept up to date with the content table. 
One way to do this is with triggers. For example:

<codeblock>