GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc,sqlite: document entryPoint argument for loadExtension · nodejs/node@e369886

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • sqlite.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/sqlite.md‎

Copy file name to clipboardExpand all lines: doc/api/sqlite.md
+27-1Lines changed: 27 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ added: v22.5.0
287287
Closes the database connection. An exception is thrown if the database is not
288288
open. This method is a wrapper around [`sqlite3_close_v2()`][].
289289

290-
### `database.loadExtension(path)`
290+
### `database.loadExtension(path[, entryPoint])`
291291

292292
<!-- YAML
293293
added:
@@ -296,11 +296,37 @@ added:
296296
-->
297297

298298
* `path` {string} The path to the shared library to load.
299+
* `entryPoint` {string} The name of the extension's entry-point function. When
300+
omitted, SQLite derives the entry point from the shared library's filename;
301+
pass this argument explicitly when the derived name does not match.
299302

300303
Loads a shared library into the database connection. This method is a wrapper
301304
around [`sqlite3_load_extension()`][]. It is required to enable the
302305
`allowExtension` option when constructing the `DatabaseSync` instance.
303306

307+
```mjs
308+
import { DatabaseSync } from 'node:sqlite';
309+
const database = new DatabaseSync(':memory:', { allowExtension: true });
310+
311+
// Load using the entry point derived from the filename.
312+
database.loadExtension('./decimal.dylib');
313+
314+
// Override the entry point when the derived name does not match.
315+
database.loadExtension('./base64.dylib', 'sqlite3_base64_init');
316+
```
317+
318+
```cjs
319+
'use strict';
320+
const { DatabaseSync } = require('node:sqlite');
321+
const database = new DatabaseSync(':memory:', { allowExtension: true });
322+
323+
// Load using the entry point derived from the filename.
324+
database.loadExtension('./decimal.dylib');
325+
326+
// Override the entry point when the derived name does not match.
327+
database.loadExtension('./base64.dylib', 'sqlite3_base64_init');
328+
```
329+
304330
### `database.enableLoadExtension(allow)`
305331

306332
<!-- YAML

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.