用法:
enable_load_extension(enabled)
此例程允許/禁止 SQLite 引擎從共享庫加載 SQLite 擴展。 SQLite 擴展可以定義新的函數、聚合或全新的虛擬表實現。一個眾所周知的擴展是隨 SQLite 分發的 fulltext-search 擴展。
默認情況下禁用可加載擴展。見1。
使用參數
connection
,enabled
引發審計事件sqlite3.enable_load_extension
。3.2 版中的新函數。
在 3.10 版中更改:添加了
sqlite3.enable_load_extension
審計事件。import sqlite3 con = sqlite3.connect(":memory:") # enable extension loading con.enable_load_extension(True) # Load the fulltext search extension con.execute("select load_extension('./fts3.so')") # alternatively you can load the extension using an API call: # con.load_extension("./fts3.so") # disable extension loading again con.enable_load_extension(False) # example from SQLite wiki con.execute("create virtual table recipe using fts3(name, ingredients)") con.executescript(""" insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes'); insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery'); insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour'); insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter'); """) for row in con.execute("select rowid, name, ingredients from recipe where name match 'pie'"): print(row) con.close()
相關用法
- Python sqlite3.Connection.text_factory用法及代碼示例
- Python sqlite3.Connection.iterdump用法及代碼示例
- Python sqlite3.Connection.create_collation用法及代碼示例
- Python sqlite3.Connection.row_factory用法及代碼示例
- Python sqlite3.Connection.create_function用法及代碼示例
- Python sqlite3.Connection.create_aggregate用法及代碼示例
- Python sqlite3.Connection.backup用法及代碼示例
- Python sqlite3.Cursor.executescript用法及代碼示例
- Python sqlite3.Cursor.connection用法及代碼示例
- Python sqlite3.Cursor.executemany用法及代碼示例
- Python sqlite3.threadsafety用法及代碼示例
- Python sqlite3.complete_statement用法及代碼示例
- Python sqlite3.connect用法及代碼示例
- Python math sqrt()用法及代碼示例
- Python sklearn.cluster.MiniBatchKMeans用法及代碼示例
- Python scipy.ndimage.binary_opening用法及代碼示例
- Python scipy.signal.windows.tukey用法及代碼示例
- Python scipy.stats.mood用法及代碼示例
- Python str.isidentifier用法及代碼示例
- Python sklearn.metrics.fbeta_score用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 sqlite3.Connection.enable_load_extension。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。