diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | test/js/bun/sqlite/sqlite.test.js | 18 |
2 files changed, 19 insertions, 1 deletions
@@ -1694,7 +1694,7 @@ sizegen: # Linux uses bundled SQLite3 ifeq ($(OS_NAME),linux) sqlite: - $(CC) $(EMIT_LLVM_FOR_RELEASE) $(CFLAGS) $(INCLUDE_DIRS) -DSQLITE_ENABLE_COLUMN_METADATA= -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_JSON1=1 $(SRC_DIR)/sqlite/sqlite3.c -c -o $(SQLITE_OBJECT) + $(CC) $(EMIT_LLVM_FOR_RELEASE) $(CFLAGS) $(INCLUDE_DIRS) -DSQLITE_ENABLE_COLUMN_METADATA= -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 $(SRC_DIR)/sqlite/sqlite3.c -c -o $(SQLITE_OBJECT) endif picohttp: diff --git a/test/js/bun/sqlite/sqlite.test.js b/test/js/bun/sqlite/sqlite.test.js index faa7d5015..e4725cac2 100644 --- a/test/js/bun/sqlite/sqlite.test.js +++ b/test/js/bun/sqlite/sqlite.test.js @@ -513,6 +513,24 @@ it("latin1 supplement chars", () => { expect(db.query("SELECT * FROM foo WHERE id > 9999").values()).toEqual([]); }); +it("supports FTS5", () => { + const db = new Database(); + db.run("CREATE VIRTUAL TABLE movies USING fts5(title, tokenize='trigram')"); + const insert = db.prepare("INSERT INTO movies VALUES ($title)"); + const insertMovies = db.transaction(movies => { + for (const movie of movies) insert.run(movie); + }); + insertMovies([ + { $title: "The Shawshank Redemption" }, + { $title: "WarGames" }, + { $title: "Interstellar" }, + { $title: "Se7en" }, + { $title: "City of God" }, + { $title: "Spirited Away" }, + ]); + expect(db.query("SELECT * FROM movies('game')").all()).toEqual([{ title: "WarGames" }]); +}); + describe("Database.run", () => { it("should not throw error `not an error` when provided query containing only whitespace", () => { const db = Database.open(":memory:"); |
