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