/usr/share/doc/python-apsw/html/vtable.html is in python-apsw-doc 3.8.6-r1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 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 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Virtual Tables — APSW 3.8.6-r1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.8.6-r1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="copyright" title="Copyright" href="copyright.html" />
<link rel="top" title="APSW 3.8.6-r1 documentation" href="index.html" />
<link rel="next" title="Virtual File System (VFS)" href="vfs.html" />
<link rel="prev" title="Backup" href="backup.html" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26815066-1']);
_gaq.push(['_trackPageview']);
</script>
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="vfs.html" title="Virtual File System (VFS)"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="backup.html" title="Backup"
accesskey="P">previous</a> |</li>
<li><a href="index.html">APSW 3.8.6-r1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="virtual-tables">
<span id="virtualtables"></span><h1>Virtual Tables<a class="headerlink" href="#virtual-tables" title="Permalink to this headline">¶</a></h1>
<p><a class="reference external" href="https://sqlite.org/vtab.html">Virtual Tables</a> are a feature
introduced in SQLite 3.3.7. They let a developer provide an underlying
table implementations, while still presenting a normal SQL interface
to the user. The person writing SQL doesn’t need to know or care that
some of the tables come from elsewhere.</p>
<p>Some examples of how you might use this:</p>
<ul class="simple">
<li>Translating to/from information stored in other formats (eg a csv/ini format file)</li>
<li>Accessing the data remotely (eg you could make a table that backends into Amazon’s API)</li>
<li>Dynamic information (eg currently running processes, files and directories, objects in your program)</li>
<li>Information that needs reformatting (eg if you have complex rules about how to convert strings to/from Unicode
in the dataset)</li>
<li>Information that isn’t relationally correct (eg if you have data that has ended up with duplicate “unique” keys
with code that dynamically corrects it)</li>
<li>There are other examples on the <a class="reference external" href="https://sqlite.org/vtab.html">SQLite page</a></li>
</ul>
<p>You need to have 3 types of object. A <a class="reference internal" href="#apsw.VTModule" title="apsw.VTModule"><tt class="xref py py-class docutils literal"><span class="pre">module</span></tt></a>, a
<a class="reference internal" href="#apsw.VTTable" title="apsw.VTTable"><tt class="xref py py-class docutils literal"><span class="pre">virtual</span> <span class="pre">table</span></tt></a> and a <a class="reference internal" href="#apsw.VTCursor" title="apsw.VTCursor"><tt class="xref py py-class docutils literal"><span class="pre">cursor</span></tt></a>. These are documented below. You can also read the <a class="reference external" href="https://sqlite.org/vtab.html">SQLite
C method documentation</a>. At the C
level, they are just one set of methods. At the Python/APSW level,
they are split over the 3 types of object. The leading <strong>x</strong> is
omitted in Python. You can return SQLite error codes (eg
<tt class="xref py py-const docutils literal"><span class="pre">SQLITE_READONLY</span></tt>) by raising the appropriate exceptions (eg
<a class="reference internal" href="exceptions.html#apsw.ReadOnlyError" title="apsw.ReadOnlyError"><tt class="xref py py-exc docutils literal"><span class="pre">ReadOnlyError</span></tt></a>). <a class="reference internal" href="apsw.html#apsw.exceptionfor" title="apsw.exceptionfor"><tt class="xref py py-meth docutils literal"><span class="pre">exceptionfor()</span></tt></a> is a useful helper
function to do the mapping.</p>
<div class="section" id="vtmodule-class">
<h2>VTModule class<a class="headerlink" href="#vtmodule-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apsw.VTModule">
<em class="property">class </em><tt class="descname">VTModule</tt><a class="headerlink" href="#apsw.VTModule" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">There is no actual <em>VTModule</em> class - it is just shown this way
for documentation convenience. Your module instance should implement
all the methods documented here.</p>
</div>
<p>A module instance is used to create the virtual tables. Once you have
a module object, you register it with a connection by calling
<a class="reference internal" href="connection.html#apsw.Connection.createmodule" title="apsw.Connection.createmodule"><tt class="xref py py-meth docutils literal"><span class="pre">Connection.createmodule()</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># make an instance</span>
<span class="n">mymod</span><span class="o">=</span><span class="n">MyModuleClass</span><span class="p">()</span>
<span class="c"># register the vtable on connection con</span>
<span class="n">con</span><span class="o">.</span><span class="n">createmodule</span><span class="p">(</span><span class="s">"modulename"</span><span class="p">,</span> <span class="n">mymod</span><span class="p">)</span>
<span class="c"># tell SQLite about the table</span>
<span class="n">con</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">"create VIRTUAL table tablename USING modulename('arg1', 2)"</span><span class="p">)</span>
</pre></div>
</div>
<p>The create step is to tell SQLite about the existence of the table.
Any number of tables referring to the same module can be made this
way. Note the (optional) arguments which are passed to the module.</p>
<dl class="method">
<dt id="apsw.VTModule.Connect">
<tt class="descclassname">VTModule.</tt><tt class="descname">Connect</tt><big>(</big><em>connection</em>, <em>modulename</em>, <em>databasename</em>, <em>tablename</em>, <em>*args</em><big>)</big> → [ sql string, table object ]<a class="headerlink" href="#apsw.VTModule.Connect" title="Permalink to this definition">¶</a></dt>
<dd><p>The parameters and return are identical to
<a class="reference internal" href="#apsw.VTModule.Create" title="apsw.VTModule.Create"><tt class="xref py py-meth docutils literal"><span class="pre">Create()</span></tt></a>. This method is called
when there are additional references to the table. <a class="reference internal" href="#apsw.VTModule.Create" title="apsw.VTModule.Create"><tt class="xref py py-meth docutils literal"><span class="pre">Create()</span></tt></a> will be called the first time and
<a class="reference internal" href="#apsw.VTModule.Connect" title="apsw.VTModule.Connect"><tt class="xref py py-meth docutils literal"><span class="pre">Connect()</span></tt></a> after that.</p>
<p>The advise is to create caches, generated data and other
heavyweight processing on <a class="reference internal" href="#apsw.VTModule.Create" title="apsw.VTModule.Create"><tt class="xref py py-meth docutils literal"><span class="pre">Create()</span></tt></a> calls and then
find and reuse that on the subsequent <a class="reference internal" href="#apsw.VTModule.Connect" title="apsw.VTModule.Connect"><tt class="xref py py-meth docutils literal"><span class="pre">Connect()</span></tt></a>
calls.</p>
<p>The corresponding call is <a class="reference internal" href="#apsw.VTTable.Disconnect" title="apsw.VTTable.Disconnect"><tt class="xref py py-meth docutils literal"><span class="pre">VTTable.Disconnect()</span></tt></a>. If you have a simple virtual table implemtation, then just
set <a class="reference internal" href="#apsw.VTModule.Connect" title="apsw.VTModule.Connect"><tt class="xref py py-meth docutils literal"><span class="pre">Connect()</span></tt></a> to be the same as <a class="reference internal" href="#apsw.VTModule.Create" title="apsw.VTModule.Create"><tt class="xref py py-meth docutils literal"><span class="pre">Create()</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre>class MyModule:
def Create(self, connection, modulename, databasename, tablename, *args):
# do lots of hard work
Connect=Create
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="apsw.VTModule.Create">
<tt class="descclassname">VTModule.</tt><tt class="descname">Create</tt><big>(</big><em>connection</em>, <em>modulename</em>, <em>databasename</em>, <em>tablename</em>, <em>*args</em><big>)</big> → [ sql string, table object ]<a class="headerlink" href="#apsw.VTModule.Create" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a table is first created on a <a class="reference internal" href="connection.html#apsw.Connection" title="apsw.Connection"><tt class="xref py py-class docutils literal"><span class="pre">connection</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>connection</strong> – An instance of <a class="reference internal" href="connection.html#apsw.Connection" title="apsw.Connection"><tt class="xref py py-class docutils literal"><span class="pre">Connection</span></tt></a></li>
<li><strong>modulename</strong> – The string name under which the module was <a class="reference internal" href="connection.html#apsw.Connection.createmodule" title="apsw.Connection.createmodule"><tt class="xref py py-meth docutils literal"><span class="pre">registered</span></tt></a></li>
<li><strong>databasename</strong> – The name of the database. This will be <tt class="docutils literal"><span class="pre">main</span></tt> for directly opened files and the name specified in
<a class="reference external" href="https://sqlite.org/lang_attach.html">ATTACH</a> statements.</li>
<li><strong>tablename</strong> – Name of the table the user wants to create.</li>
<li><strong>args</strong> – Any arguments that were specified in the <a class="reference external" href="https://sqlite.org/lang_createvtab.html">create virtual table</a> statement.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of two items. The first is a SQL <a class="reference external" href="https://sqlite.org/lang_createtable.html">create table</a> statement. The
columns are parsed so that SQLite knows what columns and declared types exist for the table. The second item
is an object that implements the <a class="reference internal" href="#apsw.VTTable" title="apsw.VTTable"><tt class="xref py py-class docutils literal"><span class="pre">table</span></tt></a> methods.</p>
</td>
</tr>
</tbody>
</table>
<p>The corresponding call is <a class="reference internal" href="#apsw.VTTable.Destroy" title="apsw.VTTable.Destroy"><tt class="xref py py-meth docutils literal"><span class="pre">VTTable.Destroy()</span></tt></a>.</p>
</dd></dl>
</div>
<div class="section" id="vttable-class">
<h2>VTTable class<a class="headerlink" href="#vttable-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apsw.VTTable">
<em class="property">class </em><tt class="descname">VTTable</tt><a class="headerlink" href="#apsw.VTTable" title="Permalink to this definition">¶</a></dt>
<dd><div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">There is no actual <em>VTTable</em> class - it is just shown this way for
documentation convenience. Your table instance should implement
the methods documented here.</p>
</div>
<p>The <a class="reference internal" href="#apsw.VTTable" title="apsw.VTTable"><tt class="xref py py-class docutils literal"><span class="pre">VTTable</span></tt></a> object contains knowledge of the indices, makes
cursors and can perform transactions.</p>
<p id="vtablestructure">A virtual table is structured as a series of rows, each of which has
the same columns. The value in a column must be one of the <a class="reference external" href="https://sqlite.org/datatype3.html">5
supported types</a>, but the
type can be different between rows for the same column. The virtual
table routines identify the columns by number, starting at zero.</p>
<p>Each row has a <strong>unique</strong> 64 bit integer <a class="reference external" href="https://sqlite.org/autoinc.html">rowid</a> with the <a class="reference internal" href="#apsw.VTCursor" title="apsw.VTCursor"><tt class="xref py py-class docutils literal"><span class="pre">Cursor</span></tt></a> routines operating on this number, as well as some of
the <a class="reference internal" href="#apsw.VTTable" title="apsw.VTTable"><tt class="xref py py-class docutils literal"><span class="pre">Table</span></tt></a> routines such as <a class="reference internal" href="#apsw.VTTable.UpdateChangeRow" title="apsw.VTTable.UpdateChangeRow"><tt class="xref py py-meth docutils literal"><span class="pre">UpdateChangeRow</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Begin">
<tt class="descclassname">VTTable.</tt><tt class="descname">Begin</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Begin" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used as part of transactions. You do not have to
provide the method.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.BestIndex">
<tt class="descclassname">VTTable.</tt><tt class="descname">BestIndex</tt><big>(</big><em>constraints</em>, <em>orderbys</em><big>)</big><a class="headerlink" href="#apsw.VTTable.BestIndex" title="Permalink to this definition">¶</a></dt>
<dd><p>This is a complex method. To get going initially, just return
<tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> and you will be fine. Implementing this method reduces
the number of rows scanned in your table to satisfy queries, but
only if you have an index or index like mechanism available.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The implementation of this method differs slightly from the
<a class="reference external" href="https://sqlite.org/vtab.html">SQLite documentation</a>
for the C API. You are not passed “unusable” constraints. The
argv/constraintarg positions are not off by one. In the C api, you
have to return position 1 to get something passed to
<a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">VTCursor.Filter()</span></tt></a> in position 0. With the APSW
implementation, you return position 0 to get Filter arg 0,
position 1 to get Filter arg 1 etc.</p>
</div>
<p>The purpose of this method is to ask if you have the ability to
determine if a row meets certain constraints that doesn’t involve
visiting every row. An example constraint is <tt class="docutils literal"><span class="pre">price</span> <span class="pre">></span> <span class="pre">74.99</span></tt>. In a
traditional SQL database, queries with constraints can be speeded up
<a class="reference external" href="https://sqlite.org/lang_createindex.html">with indices</a>. If
you return None, then SQLite will visit every row in your table and
evaluate the constraint itself. Your index choice returned from
BestIndex will also be passed to the <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">Filter()</span></tt></a> method on your cursor
object. Note that SQLite may call this method multiple times trying
to find the most efficient way of answering a complex query.</p>
<p><strong>constraints</strong></p>
<p>You will be passed the contraints as a sequence of tuples containing two
items. The first item is the column number and the second item is
the operation.</p>
<blockquote>
<div><p>Example query: <tt class="docutils literal"><span class="pre">select</span> <span class="pre">*</span> <span class="pre">from</span> <span class="pre">foo</span> <span class="pre">where</span> <span class="pre">price</span> <span class="pre">></span> <span class="pre">74.99</span> <span class="pre">and</span>
<span class="pre">quantity<=10</span> <span class="pre">and</span> <span class="pre">customer='Acme</span> <span class="pre">Widgets'</span></tt></p>
<p>If customer is column 0, price column 2 and quantity column 5
then the constraints will be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_GT</span><span class="p">),</span>
<span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_LE</span><span class="p">),</span>
<span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_EQ</span><span class="p">)</span>
</pre></div>
</div>
<p>Note that you do not get the value of the constraint (ie “Acme
Widgets”, 74.99 and 10 in this example).</p>
</div></blockquote>
<p>If you do have any suitable indices then you return a sequence the
same length as constraints with the members mapping to the
constraints in order. Each can be one of None, an integer or a tuple
of an integer and a boolean. Conceptually SQLite is giving you a
list of constraints and you are returning a list of the same length
describing how you could satisfy each one.</p>
<p>Each list item returned corresponding to a constraint is one of:</p>
<blockquote>
<div><dl class="docutils">
<dt>None</dt>
<dd>This means you have no index for that constraint. SQLite
will have to iterate over every row for it.</dd>
<dt>integer</dt>
<dd>This is the argument number for the constraintargs being passed
into the <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">Filter()</span></tt></a> function of your
<a class="reference internal" href="#apsw.VTCursor" title="apsw.VTCursor"><tt class="xref py py-class docutils literal"><span class="pre">cursor</span></tt></a> (the values “Acme Widgets”, 74.99
and 10 in the example).</dd>
<dt>(integer, boolean)</dt>
<dd>By default SQLite will check what you return. For example if
you said that you had an index on price, SQLite will still
check that each row you returned is greater than 74.99. If you
set the boolean to False then SQLite won’t do that double
checking.</dd>
</dl>
</div></blockquote>
<p>Example query: <tt class="docutils literal"><span class="pre">select</span> <span class="pre">*</span> <span class="pre">from</span> <span class="pre">foo</span> <span class="pre">where</span> <span class="pre">price</span> <span class="pre">></span> <span class="pre">74.99</span> <span class="pre">and</span>
<span class="pre">quantity<=10</span> <span class="pre">and</span> <span class="pre">customer=='Acme</span> <span class="pre">Widgets'</span></tt>. customer is column 0,
price column 2 and quantity column 5. You can index on customer
equality and price.</p>
<table border="1" class="docutils">
<colgroup>
<col width="56%" />
<col width="44%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Constraints (in)</th>
<th class="head">Constraints used (out)</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><div class="first last highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_GT</span><span class="p">),</span>
<span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_LE</span><span class="p">),</span>
<span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_EQ</span><span class="p">)</span>
</pre></div>
</div>
</td>
<td><div class="first last highlight-python"><div class="highlight"><pre><span class="mi">1</span><span class="p">,</span>
<span class="bp">None</span><span class="p">,</span>
<span class="mi">0</span>
</pre></div>
</div>
</td>
</tr>
</tbody>
</table>
<p>When your <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-class docutils literal"><span class="pre">Filter</span></tt></a> method in the cursor is called,
constraintarg[0] will be “Acme Widgets” (customer constraint value)
and constraintarg[1] will be 74.99 (price constraint value). You can
also return an index number (integer) and index string to use
(SQLite attaches no significance to these values - they are passed
as is to your <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">VTCursor.Filter()</span></tt></a> method as a way for the
BestIndex method to let the <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">Filter()</span></tt></a> method know
which of your indices or similar mechanism to use.</p>
<p><strong>orderbys</strong></p>
<p>The second argument to BestIndex is a sequence of orderbys because
the query requested the results in a certain order. If your data is
already in that order then SQLite can give the results back as
is. If not, then SQLite will have to sort the results first.</p>
<blockquote>
<div><p>Example query: <tt class="docutils literal"><span class="pre">select</span> <span class="pre">*</span> <span class="pre">from</span> <span class="pre">foo</span> <span class="pre">order</span> <span class="pre">by</span> <span class="pre">price</span> <span class="pre">desc,</span> <span class="pre">quantity</span> <span class="pre">asc</span></tt></p>
<p>Price is column 2, quantity column 5 so orderbys will be:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="bp">True</span><span class="p">),</span> <span class="c"># True means descending, False is ascending</span>
<span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
</pre></div>
</div>
</div></blockquote>
<p><strong>Return</strong></p>
<p>You should return up to 5 items. Items not present in the return have a default value.</p>
<dl class="docutils">
<dt>0: constraints used (default None)</dt>
<dd>This must either be None or a sequence the same length as
constraints passed in. Each item should be as specified above
saying if that constraint is used, and if so which constraintarg
to make the value be in your <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">VTCursor.Filter()</span></tt></a> function.</dd>
<dt>1: index number (default zero)</dt>
<dd>This value is passed as is to <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">VTCursor.Filter()</span></tt></a></dd>
<dt>2: index string (default None)</dt>
<dd>This value is passed as is to <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">VTCursor.Filter()</span></tt></a></dd>
<dt>3: orderby consumed (default False)</dt>
<dd>Return True if your output will be in exactly the same order as the orderbys passed in</dd>
<dt>4: estimated cost (default a huge number)</dt>
<dd>Approximately how many disk operations are needed to provide the
results. SQLite uses the cost to optimise queries. For example if
the query includes <em>A or B</em> and A has 2,000 operations and B has 100
then it is best to evaluate B before A.</dd>
</dl>
<p><strong>A complete example</strong></p>
<p>Query is <tt class="docutils literal"><span class="pre">select</span> <span class="pre">*</span> <span class="pre">from</span> <span class="pre">foo</span> <span class="pre">where</span> <span class="pre">price>74.99</span> <span class="pre">and</span> <span class="pre">quantity<=10</span> <span class="pre">and</span>
<span class="pre">customer=="Acme</span> <span class="pre">Widgets"</span> <span class="pre">order</span> <span class="pre">by</span> <span class="pre">price</span> <span class="pre">desc,</span> <span class="pre">quantity</span> <span class="pre">asc</span></tt>.
Customer is column 0, price column 2 and quantity column 5. You can
index on customer equality and price.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">BestIndex</span><span class="p">(</span><span class="n">constraints</span><span class="p">,</span> <span class="n">orderbys</span><span class="p">)</span>
<span class="n">constraints</span><span class="o">=</span> <span class="p">(</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_GT</span><span class="p">),</span>
<span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_LE</span><span class="p">),</span>
<span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">apsw</span><span class="o">.</span><span class="n">SQLITE_INDEX_CONSTRAINT_EQ</span><span class="p">)</span> <span class="p">)</span>
<span class="n">orderbys</span><span class="o">=</span> <span class="p">(</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="bp">True</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span> <span class="p">)</span>
<span class="c"># You return</span>
<span class="p">(</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="c"># constraints used</span>
<span class="mi">27</span><span class="p">,</span> <span class="c"># index number</span>
<span class="s">"idx_pr_cust"</span><span class="p">,</span> <span class="c"># index name</span>
<span class="bp">False</span><span class="p">,</span> <span class="c"># results are not in orderbys order</span>
<span class="mi">1000</span> <span class="c"># about 1000 disk operations to access index</span>
<span class="p">)</span>
<span class="c"># Your Cursor.Filter method will be called with:</span>
<span class="mi">27</span><span class="p">,</span> <span class="c"># index number you returned</span>
<span class="s">"idx_pr_cust"</span><span class="p">,</span> <span class="c"># index name you returned</span>
<span class="s">"Acme Widgets"</span><span class="p">,</span> <span class="c"># constraintarg[0] - customer</span>
<span class="mf">74.99</span> <span class="c"># constraintarg[1] - price</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Commit">
<tt class="descclassname">VTTable.</tt><tt class="descname">Commit</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Commit" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used as part of transactions. You do not have to
provide the method.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Destroy">
<tt class="descclassname">VTTable.</tt><tt class="descname">Destroy</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Destroy" title="Permalink to this definition">¶</a></dt>
<dd><p>The opposite of <a class="reference internal" href="#apsw.VTModule.Create" title="apsw.VTModule.Create"><tt class="xref py py-meth docutils literal"><span class="pre">VTModule.Create()</span></tt></a>. This method is called when
the table is no longer used. Note that you must always release
resources even if you intend to return an error, as it will not be
called again on error. SQLite may also <a class="reference external" href="https://sqlite.org/cvstrac/tktview?tn=2099">leak memory</a> if you return an error.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Disconnect">
<tt class="descclassname">VTTable.</tt><tt class="descname">Disconnect</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>The opposite of <a class="reference internal" href="#apsw.VTModule.Connect" title="apsw.VTModule.Connect"><tt class="xref py py-meth docutils literal"><span class="pre">VTModule.Connect()</span></tt></a>. This method is called when
a reference to a virtual table is no longer used, but <a class="reference internal" href="#apsw.VTTable.Destroy" title="apsw.VTTable.Destroy"><tt class="xref py py-meth docutils literal"><span class="pre">VTTable.Destroy()</span></tt></a> will
be called when the table is no longer used.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.FindFunction">
<tt class="descclassname">VTTable.</tt><tt class="descname">FindFunction</tt><big>(</big><em>name</em>, <em>nargs</em><big>)</big><a class="headerlink" href="#apsw.VTTable.FindFunction" title="Permalink to this definition">¶</a></dt>
<dd><p>Called to find if the virtual table has its own implementation of a
particular scalar function. You should return the function if you
have it, else return None. You do not have to provide this method.</p>
<p>This method is called while SQLite is <a class="reference external" href="https://sqlite.org/c3ref/prepare.html">preparing</a> a query. If a query is
in the <a class="reference internal" href="execution.html#statementcache"><em>statement cache</em></a> then <em>FindFunction</em>
won’t be called again. If you want to return different
implementations for the same function over time then you will need
to disable the <a class="reference internal" href="execution.html#statementcache"><em>statement cache</em></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> – The function name</li>
<li><strong>nargs</strong> – How many arguments the function takes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<ul class="last simple">
<li><a class="reference internal" href="connection.html#apsw.Connection.overloadfunction" title="apsw.Connection.overloadfunction"><tt class="xref py py-meth docutils literal"><span class="pre">Connection.overloadfunction()</span></tt></a></li>
</ul>
</div>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Open">
<tt class="descclassname">VTTable.</tt><tt class="descname">Open</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Open" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a <a class="reference internal" href="#apsw.VTCursor" title="apsw.VTCursor"><tt class="xref py py-class docutils literal"><span class="pre">cursor</span></tt></a> object.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Rename">
<tt class="descclassname">VTTable.</tt><tt class="descname">Rename</tt><big>(</big><em>newname</em><big>)</big><a class="headerlink" href="#apsw.VTTable.Rename" title="Permalink to this definition">¶</a></dt>
<dd><p>Notification that the table will be given a new name. If you return
without raising an exception, then SQLite renames the table (you
don’t have to do anything). If you raise an exception then the
renaming is prevented. You do not have to provide this method.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Rollback">
<tt class="descclassname">VTTable.</tt><tt class="descname">Rollback</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Rollback" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used as part of transactions. You do not have to
provide the method.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.Sync">
<tt class="descclassname">VTTable.</tt><tt class="descname">Sync</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTTable.Sync" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used as part of transactions. You do not have to
provide the method.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.UpdateChangeRow">
<tt class="descclassname">VTTable.</tt><tt class="descname">UpdateChangeRow</tt><big>(</big><em>row</em>, <em>newrowid</em>, <em>fields</em><big>)</big><a class="headerlink" href="#apsw.VTTable.UpdateChangeRow" title="Permalink to this definition">¶</a></dt>
<dd><p>Change an existing row. You may also need to change the rowid - for example if the query was
<tt class="docutils literal"><span class="pre">UPDATE</span> <span class="pre">table</span> <span class="pre">SET</span> <span class="pre">rowid=rowid+100</span> <span class="pre">WHERE</span> <span class="pre">...</span></tt></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>row</strong> – The existing 64 bit integer rowid</li>
<li><strong>newrowid</strong> – If not the same as <em>row</em> then also change the rowid to this.</li>
<li><strong>fields</strong> – A tuple of values the same length and order as columns in your table</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.UpdateDeleteRow">
<tt class="descclassname">VTTable.</tt><tt class="descname">UpdateDeleteRow</tt><big>(</big><em>rowid</em><big>)</big><a class="headerlink" href="#apsw.VTTable.UpdateDeleteRow" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete the row with the specified <em>rowid</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>rowid</strong> – 64 bit integer</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="apsw.VTTable.UpdateInsertRow">
<tt class="descclassname">VTTable.</tt><tt class="descname">UpdateInsertRow</tt><big>(</big><em>rowid</em>, <em>fields</em><big>)</big> → newrowid<a class="headerlink" href="#apsw.VTTable.UpdateInsertRow" title="Permalink to this definition">¶</a></dt>
<dd><p>Insert a row with the specified <em>rowid</em>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>rowid</strong> – <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> if you should choose the rowid yourself, else a 64 bit integer</li>
<li><strong>fields</strong> – A tuple of values the same length and order as columns in your table</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">If <em>rowid</em> was <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> then return the id you assigned
to the row. If <em>rowid</em> was not <tt class="xref py py-const docutils literal"><span class="pre">None</span></tt> then the return value
is ignored.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="vtcursor-class">
<h2>VTCursor class<a class="headerlink" href="#vtcursor-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apsw.VTCursor">
<em class="property">class </em><tt class="descname">VTCursor</tt><a class="headerlink" href="#apsw.VTCursor" title="Permalink to this definition">¶</a></dt>
<dd><div class="admonition note">
<p class="first admonition-title">Note</p>
<blockquote>
<div>There is no actual <em>VTCursor</em> class - it is just shown this
way for documentation convenience. Your cursor instance should
implement all the methods documented here.</div></blockquote>
<p>The <a class="reference internal" href="#apsw.VTCursor" title="apsw.VTCursor"><tt class="xref py py-class docutils literal"><span class="pre">VTCursor</span></tt></a> object is used for iterating over a table.
There may be many cursors simultaneously so each one needs to keep
track of where it is.</p>
<div class="last admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="#vtablestructure"><em>Virtual table structure</em></a></p>
</div>
</div>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Close">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Close</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTCursor.Close" title="Permalink to this definition">¶</a></dt>
<dd><p>This is the destructor for the cursor. Note that you must
cleanup. The method will not be called again if you raise an
exception.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Column">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Column</tt><big>(</big><em>number</em><big>)</big><a class="headerlink" href="#apsw.VTCursor.Column" title="Permalink to this definition">¶</a></dt>
<dd><p>Requests the value of the specified column <em>number</em> of the current
row. If <em>number</em> is -1 then return the rowid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Must be one one of the <a class="reference internal" href="types.html#types"><em>5
supported types</em></a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Eof">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Eof</tt><big>(</big><big>)</big> → bool<a class="headerlink" href="#apsw.VTCursor.Eof" title="Permalink to this definition">¶</a></dt>
<dd><p>Called to ask if we are at the end of the table. It is called after each call to Filter and Next.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">False if the cursor is at a valid row of data, else True</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method can only return True or False to SQLite. If you have
an exception in the method or provide a non-boolean return then
True (no more data) will be returned to SQLite.</p>
</div>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Filter">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Filter</tt><big>(</big><em>indexnum</em>, <em>indexname</em>, <em>constraintargs</em><big>)</big><a class="headerlink" href="#apsw.VTCursor.Filter" title="Permalink to this definition">¶</a></dt>
<dd><p>This method is always called first to initialize an iteration to the
first row of the table. The arguments come from the
<a class="reference internal" href="#apsw.VTTable.BestIndex" title="apsw.VTTable.BestIndex"><tt class="xref py py-meth docutils literal"><span class="pre">BestIndex()</span></tt></a> method in the <a class="reference internal" href="#apsw.VTTable" title="apsw.VTTable"><tt class="xref py py-class docutils literal"><span class="pre">table</span></tt></a>
object with constraintargs being a tuple of the constraints you
requested. If you always return None in BestIndex then indexnum will
be zero, indexstring will be None and constraintargs will be empty).</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Next">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Next</tt><big>(</big><big>)</big><a class="headerlink" href="#apsw.VTCursor.Next" title="Permalink to this definition">¶</a></dt>
<dd><p>Move the cursor to the next row. Do not have an exception if there
is no next row. Instead return False when <a class="reference internal" href="#apsw.VTCursor.Eof" title="apsw.VTCursor.Eof"><tt class="xref py py-meth docutils literal"><span class="pre">Eof()</span></tt></a> is
subsequently called.</p>
<p>If you said you had indices in your <a class="reference internal" href="#apsw.VTTable.BestIndex" title="apsw.VTTable.BestIndex"><tt class="xref py py-meth docutils literal"><span class="pre">VTTable.BestIndex()</span></tt></a>
return, and they were selected for use as provided in the parameters
to <a class="reference internal" href="#apsw.VTCursor.Filter" title="apsw.VTCursor.Filter"><tt class="xref py py-meth docutils literal"><span class="pre">Filter()</span></tt></a> then you should move to the next
appropriate indexed and constrained row.</p>
</dd></dl>
<dl class="method">
<dt id="apsw.VTCursor.Rowid">
<tt class="descclassname">VTCursor.</tt><tt class="descname">Rowid</tt><big>(</big><big>)</big> → 64 bit integer<a class="headerlink" href="#apsw.VTCursor.Rowid" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current rowid.</p>
</dd></dl>
</div>
<div class="section" id="troubleshooting-virtual-tables">
<h2>Troubleshooting virtual tables<a class="headerlink" href="#troubleshooting-virtual-tables" title="Permalink to this headline">¶</a></h2>
<p>Virtual Tables are a relatively recent addition to SQLite and haven’t
been widely used yet. They do work well if all your routines work
perfectly.</p>
<p>A big help is using the local variables recipe as described in
<a class="reference internal" href="exceptions.html#augmentedstacktraces"><em>augmented stack traces</em></a> which will give
you more details in errors, and shows an example with the complex
<a class="reference internal" href="#apsw.VTTable.BestIndex" title="apsw.VTTable.BestIndex"><tt class="xref py py-meth docutils literal"><span class="pre">BestIndex()</span></tt></a> function.</p>
<p>You may also find errors compounding. For
example if you have an error in the Filter method of a cursor, SQLite
then closes the cursor. If you also return an error in the Close
method then the first error may mask the second or vice versa.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">SQLite may ignore responses from your methods if they don’t make
sense. For example in BestIndex, if you set multiple arguments to
have the same constraintargs position then your Filter won’t
receive any constraintargs at all.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Virtual Tables</a><ul>
<li><a class="reference internal" href="#vtmodule-class">VTModule class</a></li>
<li><a class="reference internal" href="#vttable-class">VTTable class</a></li>
<li><a class="reference internal" href="#vtcursor-class">VTCursor class</a></li>
<li><a class="reference internal" href="#troubleshooting-virtual-tables">Troubleshooting virtual tables</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="backup.html"
title="previous chapter">Backup</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="vfs.html"
title="next chapter">Virtual File System (VFS)</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/vtable.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="vfs.html" title="Virtual File System (VFS)"
>next</a> |</li>
<li class="right" >
<a href="backup.html" title="Backup"
>previous</a> |</li>
<li><a href="index.html">APSW 3.8.6-r1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="copyright.html">Copyright</a> 2004-2014, Roger Binns <rogerb@rogerbinns.com>.
Last updated on Sep 07, 2014.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
|