@@ -16,6 +16,9 @@ import (
16
16
sqlite "github.com/gwenn/gosqlite"
17
17
)
18
18
19
+ // SqliteDebug displays some SQLite related debugging information (on the backend), when set to a non-0 value
20
+ const SqliteDebug = 0
21
+
19
22
// SQLite Functions
20
23
type function string
21
24
@@ -109,6 +112,13 @@ const (
109
112
fnJsonEach function = "json_each"
110
113
fnJsonTree function = "json_tree"
111
114
115
+ // FTS5 functions
116
+ fnBm25 function = "bm25"
117
+ fnFts function = "fts5"
118
+ fnFts5Vocab function = "fts5vocab"
119
+ fnHighlight function = "highlight"
120
+ fnSnippet function = "snippet"
121
+
112
122
// Other functions we should allow
113
123
fnVersion function = "sqlite_version"
114
124
)
@@ -192,6 +202,11 @@ var SQLiteFunctions = []function{
192
202
fnJsonGroupObject ,
193
203
fnJsonEach ,
194
204
fnJsonTree ,
205
+ fnBm25 ,
206
+ fnFts ,
207
+ fnFts5Vocab ,
208
+ fnHighlight ,
209
+ fnSnippet ,
195
210
fnVersion ,
196
211
}
197
212
@@ -205,6 +220,11 @@ func init() {
205
220
// AuthorizerLive is a SQLite authorizer callback intended to allow almost anything. Except for loading extensions,
206
221
// and running pragmas.
207
222
func AuthorizerLive (d interface {}, action sqlite.Action , tableName , funcName , dbName , triggerName string ) sqlite.Auth {
223
+ if SqliteDebug > 0 {
224
+ // Display some useful debug info
225
+ log .Printf ("AuthorizerLive - action: '%s', table: '%s', function: '%s'" , action , tableName , funcName )
226
+ }
227
+
208
228
switch action {
209
229
case sqlite .Pragma :
210
230
// The "index_info" and "table_info" Pragmas are allowed, as they're used by SQLite internally for things we need
0 commit comments