Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tips:sqlite [2020/01/21 16:08] – created scipio | tips:sqlite [2020/01/22 09:46] (current) – scipio | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== sqlite ====== | ====== sqlite ====== | ||
- | compile from sources | + | compile from sources |
- | < | + | < |
- | git clone https://github.com/sqlite/ | + | cd /tmp |
+ | |||
+ | if [ ! -d sqlite ]; then | ||
+ | [ -f sqlite.tar.gz ] || wget https://www.sqlite.org/ | ||
+ | tar zxf sqlite.tar.gz | ||
+ | fi | ||
cd sqlite | cd sqlite | ||
- | mkdir build | + | export CFLAGS=" |
- | cd build | + | |
- | ../ | + | |
- | make -j4 | + | -DSQLITE_ENABLE_FTS5 \ |
- | gcc -shared -fPIC -Wall -I ./tsrc ../sqlite/ | + | -DSQLITE_ENABLE_JSON1 \ |
- | + | -DSQLITE_ENABLE_LOAD_EXTENSION \ | |
+ | -DSQLITE_ENABLE_RTREE \ | ||
+ | -DSQLITE_ENABLE_STAT4 \ | ||
+ | -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \ | ||
+ | -DSQLITE_SOUNDEX \ | ||
+ | -DSQLITE_TEMP_STORE=3 \ | ||
+ | -DSQLITE_USE_URI \ | ||
+ | -O2 \ | ||
+ | -fPIC" | ||
+ | |||
+ | export PREFIX=" | ||
+ | LIBS=" | ||
+ | make -j4 && \ | ||
+ | make install && \ | ||
+ | gcc -shared -fPIC -Wall -O2 -I ./ ext/ | ||
+ | |||
+ | echo "Add ' | ||
</ | </ | ||
<file python test.py> | <file python test.py> | ||
import sqlite3 | import sqlite3 | ||
+ | |||
db = sqlite3.connect(': | db = sqlite3.connect(': | ||
db.enable_load_extension(True) | db.enable_load_extension(True) | ||
- | db.load_extension(' | + | db.load_extension(' |
db.enable_load_extension(False) | db.enable_load_extension(False) | ||
c = db.cursor() | c = db.cursor() | ||
Line 25: | Line 49: | ||
c.execute(' | c.execute(' | ||
print(c.fetchall()) | print(c.fetchall()) | ||
- | </code> | + | </file> |