1<!doctype html>
2<html lang="en-us">
3  <head>
4    <meta charset="utf-8">
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6    <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
7    <title>sqlite3 Module Symbols</title>
8  </head>
9  <body>
10
11<div class="fossil-doc" data-title="sqlite3 Module Symbols"><!-- EXTRACT_BEGIN -->
12<!--
13    The part of this doc wrapped in div.fossil-doc gets snipped out
14    from the canonical copy in the main tree (ext/wasm/module-symbols.html)
15    and added to the wasm docs repository, where it's served from
16    fossil.
17 -->
18  <style>
19    .pseudolist {
20        column-count: auto;
21        column-width: 20rem;
22        column-gap: 1.5em;
23        width: 95%;
24        margin: auto;
25    }
26    .pseudolist > span {
27        font-family: monospace;
28        margin: 0.25em 0;
29        display: block;
30    }
31    .pseudolist.wrap-anywhere {
32        overflow-wrap: anywhere;
33    }
34    .warning { color: firebrick }
35    .error { color: firebrick; background-color: yellow}
36    .hidden, .initially-hidden {
37        position: absolute !important;
38        opacity: 0 !important;
39        pointer-events: none !important;
40        display: none !important;
41    }
42    h1::before, h2::before, h3::before, h4::before {
43        /* Remove automatic numbering */
44        content: "" !important;
45        background-color: transparent !important;
46        margin: 0 !important;
47        border: 0 !important;
48        padding: 0 !important;
49    }
50    .func-wasm {
51
52    }
53    .func-wasm::after {
54        content: "*";
55        color: blue;
56    }
57  </style>
58  <p id='module-load-status'><strong>Loading WASM module...</strong>
59    If this takes "a long time" it may have failed and the browser's
60    dev console may contain hints as to why.
61  </p>
62
63  <p>
64    This page lists the SQLite3 APIs exported
65    by <code>sqlite3.wasm</code> and exposed to clients
66    by <code>sqlite3.js</code>. These lists are generated dynamically
67    by loading the JS/WASM module and introspecting it, with the following
68    caveats:
69  </p>
70
71  <ul>
72    <li>Some APIs are explicitly filtered out of these lists because
73      they are strictly for internal use within the JS/WASM APIs and
74      its own test code.
75    </li>
76    <li>This page runs in the main UI thread so cannot see features
77      which are only available in a Worker thread. If this page were
78      to function via a Worker, it would not be able to see
79      functionality only available in the main thread. Starting a
80      Worker here to fetch those symbols requires loading a second
81      copy of the sqlite3 WASM module and JS code.
82    </li>
83  </ul>
84
85  <div class='initially-hidden'>
86
87    <p>This page exposes a global symbol named <code>sqlite3</code>
88      which can be inspected using the browser's dev tools.
89    </p>
90
91    <p>Jump to...</p>
92    <ul>
93      <li><a href='#sqlite3-namespace'><code>sqlite3</code> namespace</a></li>
94      <li><a href='#sqlite3-version'><code>sqlite3.version</code> object</a></li>
95      <li><a href='#sqlite3-functions'><code>sqlite3_...()</code> functions</a></li>
96      <li><a href='#sqlite3-constants'><code>SQLITE_...</code> constants</a></li>
97      <li><a href='#sqlite3.oo1'><code>sqlite3.oo1</code></a>
98        <!--ul>
99          <li><a href='#sqlite3.oo1.DB'><code>sqlite3.oo1.DB</code></a></li>
100          <li><a href='#sqlite3.oo1.Stmt'><code>sqlite3.oo1.Stmt</code></a></li>
101        </ul-->
102      </li>
103      <li><a href='#sqlite3.wasm'><code>sqlite3.wasm</code> namespace</a></li>
104      <li><a href='#sqlite3.wasm.pstack'><code>sqlite3.wasm.pstack</code> namespace</a></li>
105      <li><a href='#compile-options'>Compilation options used in this module build.</a></li>
106    </ul>
107
108    <a id="sqlite3-namespace"></a>
109    <h1><code>sqlite3</code> Namespace</h1>
110    <p>
111      The <code>sqlite3</code> namespace object exposes the following...
112    </p>
113    <div id='list-namespace' class='pseudolist'></div>
114
115    <a id="sqlite3-version"></a>
116    <h1><code>sqlite3.version</code> Object</h1>
117    <p>
118      The <code>sqlite3.version</code> object exposes the following...
119    </p>
120    <div id='list-version' class='pseudolist wrap-anywhere'></div>
121
122    <a id="sqlite3-functions"></a>
123    <h1><code>sqlite3_...()</code> Function List</h1>
124
125    <p>The <code>sqlite3.capi</code> namespace exposes the following
126      <a href='https://sqlite.org/c3ref/funclist.html'><code>sqlite3_...()</code>
127        functions</a>...
128    </p>
129    <div id='list-functions' class='pseudolist'></div>
130    <p>
131      <code class='func-wasm'></code> = function is specific to the JS/WASM
132      bindings, not part of the C API.
133    </p>
134
135    <a id="sqlite3-constants"></a>
136    <h1><code>SQLITE_...</code> Constants</h1>
137
138    <p>The <code>sqlite3.capi</code> namespace exposes the following
139      <a href='https://sqlite.org/c3ref/constlist.html'><code>SQLITE_...</code>
140        constants</a>...
141    </p>
142    <div id='list-constants' class='pseudolist'></div>
143
144    <a id="sqlite3.oo1"></a>
145    <h1><code>sqlite3.oo1</code> Namespace</h1>
146    <p>
147      The <code>sqlite3.oo1</code> namespace exposes the following...
148    </p>
149    <div id='list-oo1' class='pseudolist'></div>
150
151    <a id="sqlite3.wasm"></a>
152    <h1><code>sqlite3.wasm</code> Namespace</h1>
153    <p>
154      The <code>sqlite3.wasm</code> namespace exposes the
155      following...
156    </p>
157    <div id='list-wasm' class='pseudolist'></div>
158
159    <a id="sqlite3.wasm.pstack"></a>
160    <h1><code>sqlite3.wasm.pstack</code> Namespace</h1>
161    <p>
162      The <code>sqlite3.wasm.pstack</code> namespace exposes the
163      following...
164    </p>
165    <div id='list-wasm-pstack' class='pseudolist'></div>
166
167    <a id="compile-options"></a>
168    <h1>Compilation Options</h1>
169    <p>
170      Compilation options used in this build of <code>sqlite3.wasm</code>...
171    </p>
172    <div id='list-compile-options' class='pseudolist'></div>
173
174  </div><!-- .initially-hidden -->
175  <script src="jswasm/sqlite3.js">/* This tag MUST be in side the
176  fossil-doc block so that this part can work without modification in
177  the wasm docs repo.  */</script>
178  <script>(async function(){
179    const eNew = (tag,parent)=>{
180        const e = document.createElement(tag);
181        if(parent) parent.appendChild(e);
182        return e;
183    };
184    const eLi = (label,parent)=>{
185        const e = eNew('span',parent);
186        e.innerText = label;
187        return e;
188    };
189    const E = (sel)=>document.querySelector(sel);
190    const EAll = (sel)=>document.querySelectorAll(sel);
191    const eFuncs = E('#list-functions'),
192          eConst = E('#list-constants');
193    const renderConst = function(name){
194        eLi(name, eConst);
195    };
196    const renderFunc = function(name){
197        let lbl = name+'()';
198        const e = eLi(lbl, eFuncs);;
199        if(name.startsWith('sqlite3_js')
200           || name.startsWith('sqlite3_wasm')){
201            e.classList.add('func-wasm');
202        }
203    };
204    const renderGeneric = function(name,value,eParent){
205        let lbl;
206        if(value instanceof Function) lbl = name+'()';
207        else{
208            switch(typeof value){
209                case 'number': case 'boolean': case 'string':
210                    lbl = name+' = '+JSON.stringify(value);
211                    break;
212                default:
213                    lbl = name + ' ['+(typeof value)+']';
214            }
215        }
216        const e = eLi(lbl, eParent);
217        if(name.startsWith('sqlite3_wasm')){
218            e.classList.add('func-wasm');
219        }
220    };
221    const renderIt = async function(sqlite3){
222        self.sqlite3 = sqlite3;
223        console.warn("sqlite3 installed as global symbol self.sqlite3.");
224        const capi = sqlite3.capi, wasm = sqlite3.wasm;
225        const cmpIcase = (a,b)=>a.toLowerCase().localeCompare(b.toLowerCase());
226        const renderX = function(tgtElem, container, keys){
227            for(const k of keys.sort(cmpIcase)){
228                renderGeneric(k, container[k], tgtElem);
229            }
230        };
231
232        const excludeNamespace = ['scriptInfo','StructBinder'];
233        renderX(
234            E('#list-namespace'), sqlite3,
235            Object.keys(sqlite3)
236                .filter((v)=>excludeNamespace.indexOf(v)<0)
237        );
238        renderX(
239            E('#list-version'), sqlite3.version,
240            Object.keys(sqlite3.version)
241        );
242
243        /* sqlite3_...() and SQLITE_... */
244        const lists = {c: [], f: []};
245        for(const [k,v] of Object.entries(capi)){
246            if(k.startsWith('SQLITE_')) lists.c.push(k);
247            else if(k.startsWith('sqlite3_')) lists.f.push(k);
248        }
249        const excludeCapi = [
250            'sqlite3_wasmfs_filename_is_persistent',
251            'sqlite3_wasmfs_opfs_dir'
252        ];
253        lists.c.sort().forEach(renderConst);
254        lists.f
255            .filter((v)=>excludeCapi.indexOf(v)<0)
256            .sort()
257            .forEach(renderFunc);
258        lists.c = lists.f = null;
259
260        renderX(E('#list-oo1'), sqlite3.oo1,
261                Object.keys(sqlite3.oo1) );
262
263        const excludeWasm = ['ctype'];
264        renderX(E('#list-wasm'),
265                wasm, Object.keys(wasm).filter((v)=>{
266                    return !v.startsWith('sqlite3_wasm_')
267                        && excludeWasm.indexOf(v)<0;
268                }));
269        const psKeys = Object.keys(wasm.pstack);
270        psKeys.push('pointer','quota','remaining');
271        renderX(E('#list-wasm-pstack'), wasm.pstack, psKeys);
272
273        const cou = wasm.compileOptionUsed();
274        renderX(E('#list-compile-options'), cou, Object.keys(cou));
275    };
276
277    /**
278       This is a module object for use with the emscripten-installed
279       sqlite3InitModule() factory function.
280    */
281    const myModule = {
282        print: (...args)=>{console.log(...args)},
283        printErr: (...args)=>{console.error(...args)},
284        /**
285           Called by the Emscripten module init bits to report loading
286           progress. It gets passed an empty argument when loading is done
287           (after onRuntimeInitialized() and any this.postRun callbacks
288           have been run).
289        */
290        setStatus: function f(text){
291            if(!f.last){
292                f.last = { text: '', step: 0 };
293                f.ui = {
294                    status: E('#module-load-status')
295                };
296            }
297            if(text === f.last.text) return;
298            f.last.text = text;
299            ++f.last.step;
300            if(text) {
301                f.ui.status.classList.remove('hidden');
302                f.ui.status.innerText = text;
303            }else{
304                f.ui.status.classList.add('hidden');
305                EAll('.initially-hidden').forEach((e)=>{
306                    e.classList.remove('initially-hidden');
307                });
308            }
309        }
310    }/*myModule*/;
311    self.sqlite3InitModule(myModule).then(renderIt);
312})();</script>
313</div><!-- .fossil-doc EXTRACT_END -->
314</body></html>
315