Manual:Templatelinks table: Difference between revisions

Content deleted Content added
update
m top: clean up links to Meta, replaced: m:Special:MyLanguage/Help: → Special:MyLanguage/Help:
 
(25 intermediate revisions by 9 users not shown)
Line 5:
<translate>
<!--T:1-->
The <tvar| name=1>'''templatelinks'''</tvar> table contains for each current [[<tvar| name=2>m:Special:MyLanguage/Help:Template</tvar>|transclusion]] the id of the host page, the namespace number of the included page, and its title without namespace.
 
<!--T:2-->
The target page may or may not exist, and due to renames and deletions may refer to different page records as time goes by.
</translate>
 
<translate><!--T:13--> Despite the name, transclusions are not limited to templates, nor to the MediaWiki parser's transclusion mechanism; various extensions use this table to mark that they have incorporated content from another page.</translate>
<translate><!--T:14--> (E.g. <tvar name=1>{{ll|Extension:Scribunto|Scribunto}}</tvar>'s <tvar name=2><code><nowiki>{{#invoke:...}}</nowiki></code></tvar> and <tvar name=3>{{ll|Extension:TemplateStyles|TemplateStyles}}</tvar>'s <tvar name=4><code><nowiki><templatestyles src="..." /></nowiki></code></tvar> both record the target page in the <tvar name=5><code>templatelinks</code></tvar> table.)</translate>
 
<translate>
==Fields== <!--T:3-->
</translate>
 
===tl_from===
<translate><!--T:4--> Key to the <tvar|id name=1>{{ll|Manual:Page table#page_id|page_id}}</tvar> of the page containingdoing the linktransclusion.</translate>
<translate>
 
<!--T:4-->
===tl_namespace===
Key to the <tvar|id>{{ll|Manual:Page table#page_id|page_id}}</> of the page containing the link.
{{MW version|version=1.6|version2=1.38}}
</translate>
<translate><!--T:6--> Key to <tvar|ns name=1>{{ll|Manual:Page table#page_namespace|page_namespace}}</tvar> of the page containingbeing thetranscluded linkpage.</translate>
<translate><!--T:7--> Used in conjunction with <tvar|title name=1><code>tl_title</code></tvar>.</translate>
 
===tl_title===
{{MW version|version=1.6|version2=1.38}}
<translate><!--T:8--> Key to <tvar|title name=1>{{ll|Manual:Page table#page_title|page_title}}</tvar> of the target page being transcluded.</translate>
<translate><!--T:10--> Used in conjunction with <tvar|ns name=1><code>tl_namespace</code></tvar>.</translate>
 
===tl_from_namespace===
{{MW 1.24|and after}}
<translate><!--T:5--> <tvar name=ns>{{ll|Manual:Page table#page_namespace|page_namespace}}</tvar> of the page doing the transclusion.</translate>
<translate>
<!--T:5-->
<tvar|ns>{{ll|Manual:Page table#page_namespace|page_namespace}}</> of the page containing the link.
</translate>
 
===tl_namespacetl_target_id===
{{MW 1.38|+}}
<translate>
<!--T:611-->
KeyForeign key to <tvar|ns name=1>{{ll|Manual:Pagedb table#page_namespace|page_namespacelinktarget|lt_id}}</> of the target page.</translatetvar>
<translate>
<!--T:7-->
Used in conjunction with <tvar|title>tl_title</>.
</translate>
 
===tl_title===
<translate>
<!--T:8-->
Key to <tvar|title>{{ll|Manual:Page table#page_title|page_title}}</> of the target page.</translate>
<translate>
<!--T:10-->
Used in conjunction with <tvar|ns>tl_namespace</>.
 
==Schema summary== <!--T:9-->
</translate>
{{MW 1.3639|+}}
{{describe table}}
<code>'''DESCRIBE''' templatelinks;</code>
<pre>
+-------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------------+------+-----+---------+-------+
| tl_from | int(10) unsigned | NO | PRI | 0 | |
| tl_target_id | bigint(20) unsigned | NO | PRI | NULL | |
| tl_from_namespace | int(11) | NO | MUL | 0 | |
+-------------------+---------------------+------+-----+---------+-------+
</pre>
 
{{MW version|version=1.38}}
{{describe table}}
<pre>
+-------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------------+------+-----+---------+-------+
| tl_from | int(10) unsigned | NO | PRI | 0 | |
| tl_namespace | int(11) | NO | PRI | 0 | |
| tl_title | varbinary(255) | NO | PRI | | |
| tl_from_namespace | int(11) | NO | MUL | 0 | |
| tl_target_id | bigint(20) unsigned | YES | MUL | NULL | |
+-------------------+---------------------+------+-----+---------+-------+
</pre>
 
{{MW version|version=1.36|version2=1.37}}
{{describe table}}
<pre>
+-------------------+------------------+------+-----+---------+-------+
Line 59 ⟶ 83:
 
{{MW version|version=1.26|version2=1.35}}
{{describe table}}
<code>'''DESCRIBE''' templatelinks;</code>
<pre>
+-------------------+------------------+------+-----+---------+-------+
Line 72 ⟶ 96:
 
{{MW version|version=1.24|version2=1.25}}
{{describe table}}
<code>'''DESCRIBE''' templatelinks;</code>
<pre>
+-------------------+---------------------+------+-----+-----------+-------+
Line 85 ⟶ 109:
 
{{MW version|version=1.10|version2=1.23}}
{{describe table}}
<code>'''DESCRIBE''' templatelinks;</code>
<pre>
+---------------+---------------------+------+-----+-----------+-------+
Line 97 ⟶ 121:
 
{{MW version|version=1.6|version2=1.9}}
{{describe table}}
<code>'''DESCRIBE''' templatelinks;</code>
<pre>
+---------------+---------------------+------+-----+-----------+-------+
Line 106 ⟶ 130:
| tl_title | varchar(255) binary | NO | PRI | 0 | |
+---------------+---------------------+------+-----+-----------+-------+
</pre>
 
<translate>
 
==Indexes== <!--T:12-->
</translate>
{{MW 1.39|and after}}
{{show index in table}}
<pre style="overflow-x: scroll; white-space: pre;">
+---------------+------------+----------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------+------------+----------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| templatelinks | 0 | PRIMARY | 1 | tl_from | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 0 | PRIMARY | 2 | tl_target_id | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 1 | tl_target_id | 1 | tl_target_id | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 1 | tl_target_id | 2 | tl_from | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 1 | tl_backlinks_namespace_target_id | 1 | tl_from_namespace | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 1 | tl_backlinks_namespace_target_id | 2 | tl_target_id | A | 0 | NULL | NULL | | BTREE | | |
| templatelinks | 1 | tl_backlinks_namespace_target_id | 3 | tl_from | A | 0 | NULL | NULL | | BTREE | | |
+---------------+------------+----------------------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
</pre>