@@ -229,18 +229,44 @@ added: v22.5.0
229229Closes the database connection. An exception is thrown if the database is not
230230open. This method is a wrapper around [ ` sqlite3_close_v2() ` ] [ ] .
231231
232- ### ` database.loadExtension(path) `
232+ ### ` database.loadExtension(path[, entryPoint] ) `
233233
234234<!-- YAML
235235added: v22.13.0
236236-->
237237
238238* ` path ` {string} The path to the shared library to load.
239+ * ` entryPoint ` {string} The name of the extension's entry-point function. When
240+ omitted, SQLite derives the entry point from the shared library's filename;
241+ pass this argument explicitly when the derived name does not match.
239242
240243Loads a shared library into the database connection. This method is a wrapper
241244around [ ` sqlite3_load_extension() ` ] [ ] . It is required to enable the
242245` allowExtension ` option when constructing the ` DatabaseSync ` instance.
243246
247+ ``` mjs
248+ import { DatabaseSync } from ' node:sqlite' ;
249+ const database = new DatabaseSync (' :memory:' , { allowExtension: true });
250+
251+ // Load using the entry point derived from the filename.
252+ database .loadExtension (' ./decimal.dylib' );
253+
254+ // Override the entry point when the derived name does not match.
255+ database .loadExtension (' ./base64.dylib' , ' sqlite3_base64_init' );
256+ ```
257+
258+ ``` cjs
259+ ' use strict' ;
260+ const { DatabaseSync } = require (' node:sqlite' );
261+ const database = new DatabaseSync (' :memory:' , { allowExtension: true });
262+
263+ // Load using the entry point derived from the filename.
264+ database .loadExtension (' ./decimal.dylib' );
265+
266+ // Override the entry point when the derived name does not match.
267+ database .loadExtension (' ./base64.dylib' , ' sqlite3_base64_init' );
268+ ```
269+
244270### ` database.enableLoadExtension(allow) `
245271
246272<!-- YAML
0 commit comments