Debian Codegraph @

www/lang_createvtab.html

raw
1 <!DOCTYPE html>
2 <html><head>
3 <meta name="viewport" content="width=device-width, initial-scale=1.0">
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <link href="sqlite.css" rel="stylesheet">
6 <title>CREATE VIRTUAL TABLE</title>
7 <!-- path= -->
8 </head>
9 <body>
10 <div class=nosearch>
11 <a href="index.html">
12 <img class="logo" src="images/sqlite370_banner.svg" alt="SQLite" border="0">
13 </a>
14 <div><!-- IE hack to prevent disappearing logo --></div>
15 <div class="tagline desktoponly">
16 Small. Fast. Reliable.<br>Choose any three.
17 </div>
18 <div class="menu mainmenu">
19 <ul>
20 <li><a href="index.html">Home</a>
21 <li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
22 <li class='wideonly'><a href='about.html'>About</a>
23 <li class='desktoponly'><a href="docs.html">Documentation</a>
24 <li class='desktoponly'><a href="download.html">Download</a>
25 <li class='wideonly'><a href='copyright.html'>License</a>
26 <li class='desktoponly'><a href="support.html">Support</a>
27 <li class='desktoponly'><a href="prosupport.html">Purchase</a>
28 <li class='search' id='search_menubutton'>
29 <a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
30 </ul>
31 </div>
32 <div class="menu submenu" id="submenu">
33 <ul>
34 <li><a href='about.html'>About</a>
35 <li><a href='docs.html'>Documentation</a>
36 <li><a href='download.html'>Download</a>
37 <li><a href='support.html'>Support</a>
38 <li><a href='prosupport.html'>Purchase</a>
39 </ul>
40 </div>
41 <div class="searchmenu" id="searchmenu">
42 <form method="GET" action="search">
43 <select name="s" id="searchtype">
44 <option value="d">Search Documentation</option>
45 <option value="c">Search Changelog</option>
46 </select>
47 <input type="text" name="q" id="searchbox" value="">
48 <input type="submit" value="Go">
49 </form>
50 </div>
51 </div>
52 <script>
53 function toggle_div(nm) {
54 var w = document.getElementById(nm);
55 if( w.style.display=="block" ){
56 w.style.display = "none";
57 }else{
58 w.style.display = "block";
59 }
60 }
61 function toggle_search() {
62 var w = document.getElementById("searchmenu");
63 if( w.style.display=="block" ){
64 w.style.display = "none";
65 } else {
66 w.style.display = "block";
67 setTimeout(function(){
68 document.getElementById("searchbox").focus()
69 }, 30);
70 }
71 }
72 function div_off(nm){document.getElementById(nm).style.display="none";}
73 window.onbeforeunload = function(e){div_off("submenu");}
74 /* Disable the Search feature if we are not operating from CGI, since */
75 /* Search is accomplished using CGI and will not work without it. */
76 if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
77 document.getElementById("search_menubutton").style.display = "none";
78 }
79 /* Used by the Hide/Show button beside syntax diagrams, to toggle the */
80 function hideorshow(btn,obj){
81 var x = document.getElementById(obj);
82 var b = document.getElementById(btn);
83 if( x.style.display!='none' ){
84 x.style.display = 'none';
85 b.innerHTML='show';
86 }else{
87 x.style.display = '';
88 b.innerHTML='hide';
89 }
90 return false;
91 }
92 var antiRobot = 0;
93 function antiRobotGo(){
94 if( antiRobot!=3 ) return;
95 antiRobot = 7;
96 var j = document.getElementById("mtimelink");
97 if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
98 }
99 function antiRobotDefense(){
100 document.body.onmousedown=function(){
101 antiRobot |= 2;
102 antiRobotGo();
103 document.body.onmousedown=null;
104 }
105 document.body.onmousemove=function(){
106 antiRobot |= 2;
107 antiRobotGo();
108 document.body.onmousemove=null;
109 }
110 setTimeout(function(){
111 antiRobot |= 1;
112 antiRobotGo();
113 }, 100)
114 antiRobotGo();
115 }
116 antiRobotDefense();
117 </script>
118 <div class=fancy>
119 <div class=nosearch>
120 <div class="fancy_title">
121 CREATE VIRTUAL TABLE
122 </div>
123 </div>
124
125
126
127
128
129 <p><b><a href="syntax/create-virtual-table-stmt.html">create-virtual-table-stmt:</a></b>
130 <button id='xcb22bf27' onclick='hideorshow("xcb22bf27","xaec3630e")'>hide</button></p>
131 <div id='xaec3630e' class='imgcontainer'>
132 <div style="max-width:624px"><svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 624.096 259.848" data-pikchr-date="20250319161943">
133 <circle cx="5.76" cy="17.28" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
134 <polygon points="32.4,17.28 20.88,21.6 20.88,12.96" style="fill:rgb(0,0,0)"/>
135 <path d="M9.36,17.28L26.64,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
136 <path d="M47.52,32.4L100.915,32.4A15.12 15.12 0 0 0 116.035 17.28A15.12 15.12 0 0 0 100.915 2.16L47.52,2.16A15.12 15.12 0 0 0 32.4 17.28A15.12 15.12 0 0 0 47.52 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
137 <text x="74.2176" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
138 <polygon points="139.075,17.28 127.555,21.6 127.555,12.96" style="fill:rgb(0,0,0)"/>
139 <path d="M116.035,17.28L133.315,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
140 <path d="M154.195,32.4L213.696,32.4A15.12 15.12 0 0 0 228.816 17.28A15.12 15.12 0 0 0 213.696 2.16L154.195,2.16A15.12 15.12 0 0 0 139.075 17.28A15.12 15.12 0 0 0 154.195 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
141 <text x="183.946" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
142 <polygon points="251.856,17.28 240.336,21.6 240.336,12.96" style="fill:rgb(0,0,0)"/>
143 <path d="M228.816,17.28L246.096,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
144 <path d="M266.976,32.4L306.317,32.4A15.12 15.12 0 0 0 321.437 17.28A15.12 15.12 0 0 0 306.317 2.16L266.976,2.16A15.12 15.12 0 0 0 251.856 17.28A15.12 15.12 0 0 0 266.976 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
145 <text x="286.646" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
146 <polygon points="357.437,17.28 345.917,21.6 345.917,12.96" style="fill:rgb(0,0,0)"/>
147 <path d="M321.437,17.28L351.677,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
148 <path d="M372.557,32.4A15.12 15.12 0 0 0 387.677 17.28A15.12 15.12 0 0 0 372.557 2.16A15.12 15.12 0 0 0 357.437 17.28A15.12 15.12 0 0 0 372.557 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
149 <text x="372.557" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
150 <polygon points="410.717,17.28 399.197,21.6 399.197,12.96" style="fill:rgb(0,0,0)"/>
151 <path d="M387.677,17.28L404.957,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
152 <path d="M425.837,32.4L445.939,32.4A15.12 15.12 0 0 0 461.059 17.28A15.12 15.12 0 0 0 445.939 2.16L425.837,2.16A15.12 15.12 0 0 0 410.717 17.28A15.12 15.12 0 0 0 425.837 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
153 <text x="435.888" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
154 <polygon points="484.099,17.28 472.579,21.6 472.579,12.96" style="fill:rgb(0,0,0)"/>
155 <path d="M461.059,17.28L478.339,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
156 <path d="M499.219,32.4L543.859,32.4A15.12 15.12 0 0 0 558.979 17.28A15.12 15.12 0 0 0 543.859 2.16L499.219,2.16A15.12 15.12 0 0 0 484.099 17.28A15.12 15.12 0 0 0 499.219 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
157 <text x="521.539" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
158 <path d="M47.52,108L143.885,108A15.12 15.12 0 0 0 159.005 92.88A15.12 15.12 0 0 0 143.885 77.76L47.52,77.76A15.12 15.12 0 0 0 32.4 92.88A15.12 15.12 0 0 0 47.52 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
159 <text x="95.7024" y="92.88" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
160 <polygon points="182.045,92.88 170.525,97.2 170.525,88.56" style="fill:rgb(0,0,0)"/>
161 <path d="M159.005,92.88L176.285,92.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
162 <path d="M197.165,108A15.12 15.12 0 0 0 212.285 92.88A15.12 15.12 0 0 0 197.165 77.76A15.12 15.12 0 0 0 182.045 92.88A15.12 15.12 0 0 0 197.165 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
163 <text x="197.165" y="92.88" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
164 <polygon points="248.285,92.88 236.765,97.2 236.765,88.56" style="fill:rgb(0,0,0)"/>
165 <path d="M212.285,92.88L242.525,92.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
166 <path d="M263.405,108L338.573,108A15.12 15.12 0 0 0 353.693 92.88A15.12 15.12 0 0 0 338.573 77.76L263.405,77.76A15.12 15.12 0 0 0 248.285 92.88A15.12 15.12 0 0 0 263.405 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
167 <text x="300.989" y="92.88" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
168 <path d="M47.52,219.888L86.5152,219.888A15.12 15.12 0 0 0 101.635 204.768A15.12 15.12 0 0 0 86.5152 189.648L47.52,189.648A15.12 15.12 0 0 0 32.4 204.768A15.12 15.12 0 0 0 47.52 219.888Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
169 <text x="67.0176" y="204.768" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
170 <polygon points="124.675,204.768 113.155,209.088 113.155,200.448" style="fill:rgb(0,0,0)"/>
171 <path d="M101.635,204.768L118.915,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
172 <path d="M139.795,219.888L234.432,219.888A15.12 15.12 0 0 0 249.552 204.768A15.12 15.12 0 0 0 234.432 189.648L139.795,189.648A15.12 15.12 0 0 0 124.675 204.768A15.12 15.12 0 0 0 139.795 219.888Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
173 <text x="187.114" y="204.768" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-name</text>
174 <polygon points="285.552,204.768 274.032,209.088 274.032,200.448" style="fill:rgb(0,0,0)"/>
175 <path d="M249.552,204.768L279.792,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
176 <path d="M300.672,219.888A15.12 15.12 0 0 0 315.792 204.768A15.12 15.12 0 0 0 300.672 189.648A15.12 15.12 0 0 0 285.552 204.768A15.12 15.12 0 0 0 300.672 219.888Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
177 <text x="300.672" y="204.768" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
178 <polygon points="351.792,204.768 340.272,209.088 340.272,200.448" style="fill:rgb(0,0,0)"/>
179 <path d="M315.792,204.768L346.032,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
180 <path d="M366.912,219.888L497.376,219.888A15.12 15.12 0 0 0 512.496 204.768A15.12 15.12 0 0 0 497.376 189.648L366.912,189.648A15.12 15.12 0 0 0 351.792 204.768A15.12 15.12 0 0 0 366.912 219.888Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
181 <text x="432.144" y="204.768" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-argument</text>
182 <polygon points="548.496,204.768 536.976,209.088 536.976,200.448" style="fill:rgb(0,0,0)"/>
183 <path d="M512.496,204.768L542.736,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
184 <path d="M563.616,219.888A15.12 15.12 0 0 0 578.736 204.768A15.12 15.12 0 0 0 563.616 189.648A15.12 15.12 0 0 0 548.496 204.768A15.12 15.12 0 0 0 563.616 219.888Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
185 <text x="563.616" y="204.768" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
186 <polygon points="614.736,204.768 603.216,209.088 603.216,200.448" style="fill:rgb(0,0,0)"/>
187 <path d="M578.736,204.768L608.976,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
188 <circle cx="618.336" cy="204.768" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
189 <path d="M432.144,257.688A15.12 15.12 0 0 0 447.264 242.568A15.12 15.12 0 0 0 432.144 227.448A15.12 15.12 0 0 0 417.024 242.568A15.12 15.12 0 0 0 432.144 257.688Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
190 <text x="432.144" y="242.568" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
191 <polygon points="447.264,242.568 458.784,238.248 458.784,246.888" style="fill:rgb(0,0,0)"/>
192 <path d="M512.496,204.768 L 519.996,204.768 Q 527.496,204.768 527.496,219.768 L 527.496,227.568 Q 527.496,242.568 512.496,242.568 L 468.024,242.568 L 453.024,242.568" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
193 <path d="M417.024,242.568 L 343.752,242.568 Q 328.752,242.568 328.752,227.568 L 328.752,219.768 Q 328.752,204.768 336.252,204.768 L 343.752,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
194 <polygon points="432.144,180.576 420.624,184.896 420.624,176.256" style="fill:rgb(0,0,0)"/>
195 <path d="M249.552,204.768 L 257.052,204.768 Q 264.552,204.768 264.552,192.672 Q 264.552,180.576 279.552,180.576 L 411.384,180.576 L 426.384,180.576" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
196 <path d="M432.144,180.576 L 576.696,180.576 Q 591.696,180.576 591.696,192.672 Q 591.696,204.768 599.196,204.768 L 606.696,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
197 <polygon points="187.114,153.36 198.634,149.04 198.634,157.68" style="fill:rgb(0,0,0)"/>
198 <path d="M353.693,92.88 L 361.193,92.88 Q 368.693,92.88 368.693,107.88 L 368.693,138.36 Q 368.693,153.36 353.693,153.36 L 207.874,153.36 L 192.874,153.36" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
199 <polygon points="32.4,204.768 20.88,209.088 20.88,200.448" style="fill:rgb(0,0,0)"/>
200 <path d="M187.114,153.36 L 20.76,153.36 Q 5.76,153.36 5.76,168.36 L 5.76,189.768 Q 5.76,204.768 16.2,204.768 L 26.64,204.768" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
201 <polygon points="429.979,62.64 441.499,58.32 441.499,66.96" style="fill:rgb(0,0,0)"/>
202 <path d="M558.979,17.28 L 566.479,17.28 Q 573.979,17.28 573.979,32.28 L 573.979,47.64 Q 573.979,62.64 558.979,62.64 L 450.739,62.64 L 435.739,62.64" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
203 <polygon points="32.4,92.88 20.88,97.2 20.88,88.56" style="fill:rgb(0,0,0)"/>
204 <path d="M429.979,62.64 L 20.76,62.64 Q 5.76,62.64 5.76,77.64 L 5.76,77.88 Q 5.76,92.88 16.2,92.88 L 26.64,92.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
205 <polygon points="336.437,47.28 332.117,35.76 340.757,35.76" style="fill:rgb(0,0,0)"/>
206 <path d="M321.437,17.28 L 328.937,17.28 Q 336.437,17.28 336.437,29.4 L 336.437,41.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
207 <path d="M336.437,47.28 L 336.437,54.96 Q 336.437,62.64 328.937,62.64 L 321.437,62.64" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
208 <polygon points="95.7024,123.12 84.1824,127.44 84.1824,118.8" style="fill:rgb(0,0,0)"/>
209 <path d="M5.76,77.76 L 5.76,108.12 Q 5.76,123.12 20.76,123.12 L 74.9424,123.12 L 89.9424,123.12" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
210 <path d="M95.7024,123.12 L 210.245,123.12 Q 225.245,123.12 225.245,108.12 L 225.245,107.88 Q 225.245,92.88 231.005,92.88 L 236.765,92.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
211 </svg>
212 </div>
213 </div>
214
215
216 <p>A <a href="vtab.html">virtual table</a> is an interface to an external storage or computation
217 engine that appears to be a table but does not actually store information
218 in the database file.</p>
219
220 <p>In general, you can do anything with a <a href="vtab.html">virtual table</a> that can be done
221 with an ordinary table, except that you cannot create indices or triggers on a
222 virtual table. Some virtual table implementations might impose additional
223 restrictions. For example, many virtual tables are read-only.</p>
224
225 <p>The <span class='yyterm'>module-name</span> is the name of an object that implements
226 the virtual table. The <span class='yyterm'>module-name</span> must be registered with
227 the SQLite database connection using
228 <a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a>
229 prior to issuing the CREATE VIRTUAL TABLE statement.
230 The module takes zero or more comma-separated arguments.
231 The arguments can be just about any text as long as it has balanced
232 parentheses. The argument syntax is sufficiently general that the
233 arguments can be made to appear as <a href="lang_createtable.html#tablecoldef">column definitions</a> in a traditional
234 <a href="lang_createtable.html">CREATE TABLE</a> statement.
235 SQLite passes the module arguments directly
236 to the <a href="vtab.html#xcreate">xCreate</a> and <a href="vtab.html#xconnect">xConnect</a> methods of the module implementation
237 without any interpretation. It is the responsibility
238 of the module implementation to parse and interpret its own arguments.</p>
239
240 <p>A virtual table is destroyed using the ordinary
241 <a href="lang_droptable.html">DROP TABLE</a> statement. There is no
242 DROP VIRTUAL TABLE statement.</p>
243 <p align="center"><small><i>This page was last updated on 2022-01-08 05:02:57Z </small></i></p>
244