mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-19 03:58:28 -05:00
Make sure to register the regexp function when creating a new database
DB4S comes with its own default implementation for the REGEXP function. This function, however, needs to be registered in order for SQLite to use it. We did that when opening a database file but not when creating a new database file, so regular expressions wouldn't work for newly created databases like they did for existing ones. This is fixed by this commit.
This commit is contained in:
@@ -384,6 +384,10 @@ bool DBBrowserDB::create ( const QString & db)
|
||||
// Enable extension loading
|
||||
sqlite3_enable_load_extension(_db, 1);
|
||||
|
||||
// Register REGEXP function
|
||||
if(Settings::getSettingsValue("extensions", "disableregex").toBool() == false)
|
||||
sqlite3_create_function(_db, "REGEXP", 2, SQLITE_UTF8, NULL, regexp, NULL, NULL);
|
||||
|
||||
// force sqlite3 do write proper file header
|
||||
// if we don't create and drop the table we might end up
|
||||
// with a 0 byte file, if the user cancels the create table dialog
|
||||
|
||||
Reference in New Issue
Block a user