mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 17:34:32 +02:00
Support entrypoints for --load-extension (#473)
* Entrypoint support, closes #470
This commit is contained in:
parent
a46a5e3a9e
commit
19dd077944
6 changed files with 145 additions and 41 deletions
|
|
@ -94,7 +94,7 @@ def load_extension_option(fn):
|
|||
return click.option(
|
||||
"--load-extension",
|
||||
multiple=True,
|
||||
help="SQLite extensions to load",
|
||||
help="Path to SQLite extension, with optional :entrypoint",
|
||||
)(fn)
|
||||
|
||||
|
||||
|
|
@ -2997,7 +2997,11 @@ def _load_extensions(db, load_extension):
|
|||
for ext in load_extension:
|
||||
if ext == "spatialite" and not os.path.exists(ext):
|
||||
ext = find_spatialite()
|
||||
db.conn.load_extension(ext)
|
||||
if ":" in ext:
|
||||
path, _, entrypoint = ext.partition(":")
|
||||
db.conn.execute("SELECT load_extension(?, ?)", [path, entrypoint])
|
||||
else:
|
||||
db.conn.load_extension(ext)
|
||||
|
||||
|
||||
def _register_functions(db, functions):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue