📄 index_info.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Virtual Table Indexing Information</title><style type="text/css">body { margin: auto; font-family: "Verdana" "sans-serif"; padding: 8px 1%;}a { color: #45735f }a:visited { color: #734559 }.logo { position:absolute; margin:3px; }.tagline { float:right; text-align:right; font-style:italic; width:240px; margin:12px; margin-top:58px;}.toolbar { font-variant: small-caps; text-align: center; line-height: 1.6em; margin: 0; padding:1px 8px;}.toolbar a { color: white; text-decoration: none; padding: 6px 12px; }.toolbar a:visited { color: white; }.toolbar a:hover { color: #80a796; background: white; }.content { margin: 5%; }.content dt { font-weight:bold; }.content dd { margin-bottom: 25px; margin-left:20%; }.content ul { padding:0px; padding-left: 15px; margin:0px; }/* rounded corners */.se { background: url(../images/se.png) 100% 100% no-repeat #80a796}.sw { background: url(../images/sw.png) 0% 100% no-repeat }.ne { background: url(../images/ne.png) 100% 0% no-repeat }.nw { background: url(../images/nw.png) 0% 0% no-repeat }</style><meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head><body><div><!-- container div to satisfy validator --><a href="../index.html"><img class="logo" src="../images/SQLite.gif" alt="SQLite Logo" border="0"></a><div><!-- IE hack to prevent disappearing logo--></div><div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div><table width=100% style="clear:both"><tr><td> <div class="se"><div class="sw"><div class="ne"><div class="nw"> <div class="toolbar"> <a href="../about.html">About</a> <a href="../sitemap.html">Sitemap</a> <a href="../docs.html">Documentation</a> <a href="../download.html">Download</a> <a href="../copyright.html">License</a> <a href="../news.html">News</a> <a href="http://www.sqlite.org/cvstrac/index">Developers</a> <a href="../support.html">Support</a> </div></div></div></div></div></td></tr></table> <a href="intro.html"><h2>SQLite C Interface</h2></a><h2>Virtual Table Indexing Information</h2><blockquote><pre>struct sqlite3_index_info { /* Inputs */ int nConstraint; /* Number of entries in aConstraint */ struct sqlite3_index_constraint { int iColumn; /* Column on left-hand side of constraint */ unsigned char op; /* Constraint operator */ unsigned char usable; /* True if this constraint is usable */ int iTermOffset; /* Used internally - xBestIndex should ignore */ } *aConstraint; /* Table of WHERE clause constraints */ int nOrderBy; /* Number of terms in the ORDER BY clause */ struct sqlite3_index_orderby { int iColumn; /* Column number */ unsigned char desc; /* True for DESC. False for ASC. */ } *aOrderBy; /* The ORDER BY clause */</pre></blockquote><p>The sqlite3_index_info structure and its substructures is used topass information into and receive the reply from the xBestIndexmethod of an sqlite3_module. The fields under **Inputs** are theinputs to xBestIndex and are read-only. xBestIndex inserts itsresults into the **Outputs** fields.</p><p>The aConstraint[] array records WHERE clause constraints of theform:</p><p>column OP expr</p><p>Where OP is =, <, <=, >, or >=.The particular operator is storedin aConstraint[].op. The index of the column is stored inaConstraint[].iColumn. aConstraint[].usable is TRUE if theexpr on the right-hand side can be evaluated (and thus the constraintis usable) and false if it cannot.</p><p>The optimizer automatically inverts terms of the form "expr OP column"and makes other simplifications to the WHERE clause in an attempt toget as many WHERE clause terms into the form shown above as possible.The aConstraint[] array only reports WHERE clause terms in the correctform that refer to the particular virtual table being queried.</p><p>Information about the ORDER BY clause is stored in aOrderBy[].Each term of aOrderBy records a column of the ORDER BY clause.</p><p>The xBestIndex method must fill aConstraintUsage[] with informationabout what parameters to pass to xFilter. If argvIndex>0 thenthe right-hand side of the corresponding aConstraint[] is evaluatedand becomes the argvIndex-th entry in argv. If aConstraintUsage[].omitis true, then the constraint is assumed to be fully handled by thevirtual table and is not checked again by SQLite.</p><p>The idxNum and idxPtr values are recorded and passed into xFilter.sqlite3_free() is used to free idxPtr if needToFreeIdxPtr is true.</p><p>The orderByConsumed means that output from xFilter will occur inthe correct order to satisfy the ORDER BY clause so that no separatesorting step is required.</p><p>The estimatedCost value is an estimate of the cost of doing theparticular lookup. A full scan of a table with N entries should havea cost of N. A binary search of a table of N entries should have acost of approximately log(N).</p><p>See also lists of <a href="objlist.html">Objects</a>, <a href="constlist.html">Constants</a>, and <a href="funclist.html">Functions</a>.</p><hr><small><i>This page last modified 2008/05/12 13:08:44 UTC</i></small></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -