node-sqlite3 icon indicating copy to clipboard operation
node-sqlite3 copied to clipboard

SQLITE_ERROR: no such function: REGEXP

Open jouannoj opened this issue 3 years ago • 0 comments

Issue Summary

When I use the REGEXP function in a query directly in sqlite 3 CLI tools it's work fine

But when I try to use it with node-sqlite3 through sequelize I got this error message: SQLITE_ERROR: no such function: REGEXP

I try the loadExtension with https://github.com/ralight/sqlite3-pcre.git but nothing works

Steps to Reproduce

npm i sqlite3

const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(':memory:');
db.loadExtension(`${__dirname}/sqlite3-pcre/pcre.so`)
db.serialize(() => {
  db.run("CREATE TABLE test (info TEXT)");

  const stmt = db.prepare("INSERT INTO test VALUES (?)");
  for (let i = 0; i < 10; i++) {
    stmt.run("Ipsum " + i);
  }
  stmt.finalize();

  db.get("SELECT rowid AS id, info FROM test WHERE info REGEXP 'Ipsum'", (err, row) => {
    if (err) {
      console.error(err)
      return
    }
    console.log(row.id + ": " + row.info);
  });
});

db.close();

Version

5.1.1

Node.js Version

14.5.4

How did you install the library?

MacOS x64

jouannoj avatar Sep 26 '22 13:09 jouannoj