@@ -20,7 +20,7 @@ import (
2020 _ "modernc.org/sqlite"
2121)
2222
23- var sf singleflight.Group
23+ var sf = & singleflight.Group {}
2424
2525func init () {
2626 // MySQL-compatible functions
@@ -118,9 +118,6 @@ type SQLRunner struct {
118118 schema string
119119
120120 cache * lru.Cache [string , * QueryResult ]
121-
122- // cache
123- filename string
124121}
125122
126123func NewSQLRunner (schema string ) (* SQLRunner , error ) {
@@ -212,16 +209,12 @@ func (r *SQLRunner) Query(ctx context.Context, query string) (*QueryResult, erro
212209//
213210// You should close the database after using it.
214211func (r * SQLRunner ) getSqliteInstance () (* sql.DB , error ) {
215- if r .filename != "" {
216- filename , err := initializeThreadSafe (r .schema )
217- if err != nil {
218- return nil , NewSchemaError (err )
219- }
220-
221- r .filename = filename
212+ filename , err := initializeThreadSafe (r .schema )
213+ if err != nil {
214+ return nil , NewSchemaError (err )
222215 }
223216
224- db , err := sql .Open ("sqlite" , fmt .Sprintf ("file:%s?mode=ro" , r . filename ))
217+ db , err := sql .Open ("sqlite" , fmt .Sprintf ("file:%s?mode=ro" , filename ))
225218 if err != nil {
226219 return nil , fmt .Errorf ("open schema database (r/o): %w" , err )
227220 }
0 commit comments