@@ -296,7 +296,7 @@ added: v22.5.0
296296Closes the database connection. An exception is thrown if the database is not
297297open. This method is a wrapper around [ ` sqlite3_close_v2() ` ] [ ] .
298298
299- ### ` database.loadExtension(path) `
299+ ### ` database.loadExtension(path[, entryPoint] ) `
300300
301301<!-- YAML
302302added:
@@ -305,11 +305,37 @@ added:
305305-->
306306
307307* ` path ` {string} The path to the shared library to load.
308+ * ` entryPoint ` {string} The name of the extension's entry-point function. When
309+ omitted, SQLite derives the entry point from the shared library's filename;
310+ pass this argument explicitly when the derived name does not match.
308311
309312Loads a shared library into the database connection. This method is a wrapper
310313around [ ` sqlite3_load_extension() ` ] [ ] . It is required to enable the
311314` allowExtension ` option when constructing the ` DatabaseSync ` instance.
312315
316+ ``` mjs
317+ import { DatabaseSync } from ' node:sqlite' ;
318+ const database = new DatabaseSync (' :memory:' , { allowExtension: true });
319+
320+ // Load using the entry point derived from the filename.
321+ database .loadExtension (' ./decimal.dylib' );
322+
323+ // Override the entry point when the derived name does not match.
324+ database .loadExtension (' ./base64.dylib' , ' sqlite3_base64_init' );
325+ ```
326+
327+ ``` cjs
328+ ' use strict' ;
329+ const { DatabaseSync } = require (' node:sqlite' );
330+ const database = new DatabaseSync (' :memory:' , { allowExtension: true });
331+
332+ // Load using the entry point derived from the filename.
333+ database .loadExtension (' ./decimal.dylib' );
334+
335+ // Override the entry point when the derived name does not match.
336+ database .loadExtension (' ./base64.dylib' , ' sqlite3_base64_init' );
337+ ```
338+
313339### ` database.enableLoadExtension(allow) `
314340
315341<!-- YAML
0 commit comments