@@ -79,6 +79,12 @@ func create(db *sqlite3.Conn, _, schema, table string, arg ...string) (_ *bloom,
79
79
80
80
t .bytes = numBytes (nelem , t .prob )
81
81
82
+ err = db .DeclareVTab (
83
+ `CREATE TABLE x(present, word HIDDEN NOT NULL PRIMARY KEY) WITHOUT ROWID` )
84
+ if err != nil {
85
+ return nil , err
86
+ }
87
+
82
88
err = db .Exec (fmt .Sprintf (
83
89
`CREATE TABLE %s.%s (data BLOB, p REAL, n INTEGER, m INTEGER, k INTEGER)` ,
84
90
sqlite3 .QuoteIdentifier (t .schema ), sqlite3 .QuoteIdentifier (t .storage )))
@@ -94,12 +100,6 @@ func create(db *sqlite3.Conn, _, schema, table string, arg ...string) (_ *bloom,
94
100
VALUES (1, zeroblob(%d), %f, %d, %d, %d)` ,
95
101
sqlite3 .QuoteIdentifier (t .schema ), sqlite3 .QuoteIdentifier (t .storage ),
96
102
t .bytes , t .prob , nelem , 8 * t .bytes , t .hashes ))
97
- if err != nil {
98
- return nil , err
99
- }
100
-
101
- err = db .DeclareVTab (
102
- `CREATE TABLE x(present, word HIDDEN NOT NULL PRIMARY KEY) WITHOUT ROWID` )
103
103
if err != nil {
104
104
t .Destroy ()
105
105
return nil , err
@@ -198,10 +198,10 @@ func (t *bloom) Integrity(schema, table string, flags int) error {
198
198
}
199
199
200
200
func (b * bloom ) BestIndex (idx * sqlite3.IndexInfo ) error {
201
- for n , cst := range idx .Constraint {
201
+ for i , cst := range idx .Constraint {
202
202
if cst .Usable && cst .Column == 1 &&
203
203
cst .Op == sqlite3 .INDEX_CONSTRAINT_EQ {
204
- idx .ConstraintUsage [n ].ArgvIndex = 1
204
+ idx .ConstraintUsage [i ].ArgvIndex = 1
205
205
idx .OrderByConsumed = true
206
206
idx .EstimatedRows = 1
207
207
idx .EstimatedCost = float64 (b .hashes )
0 commit comments