@@ -287,7 +287,7 @@ added: v22.5.0
287287Closes the database connection. An exception is thrown if the database is not
288288open. This method is a wrapper around [ ` sqlite3_close_v2() ` ] [ ] .
289289
290- ### ` database.loadExtension(path) `
290+ ### ` database.loadExtension(path[, entryPoint] ) `
291291
292292<!-- YAML
293293added:
@@ -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
300303Loads a shared library into the database connection. This method is a wrapper
301304around [ ` 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