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