Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
1005 bytes
|
Line | |
---|
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 laoding 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
|
---|
Note:
See
TracBrowser
for help on using the repository browser.