FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Doc/includes/sqlite3/load_extension.py at v3.6.15 · python/cpython · GitHub
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.3k
(2.3k)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
load_extension.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (20 loc) · 1006 Bytes
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
load_extension.py
Copy path
File metadata and controls
26 lines (20 loc) · 1006 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
)
Back
|
FazBrowse Home
|
New Git URL