Debian Codegraph @

cpython27/Doc/includes/sqlite3/load_extension.py

raw symbols SCIP
1 import sqlite3
2
3 con = sqlite3.connect(":memory:")
4
5 # enable extension loading
6 con.enable_load_extension(True)
7
8 # Load the fulltext search extension
9 con.execute("select load_extension('./fts3.so')")
10
11 # alternatively you can load the extension using an API call:
12 # con.load_extension("./fts3.so")
13
14 # disable extension loading again
15 con.enable_load_extension(False)
16
17 # example from SQLite wiki
18 con.execute("create virtual table recipe using fts3(name, ingredients)")
19 con.executescript("""
20 insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');
21 insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');
22 insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');
23 insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');
24 """)
25 for row in con.execute("select rowid, name, ingredients from recipe where name match 'pie'"):
26 print row