Skip to content

Commit d737620

Browse files
committed
Fix.
1 parent 83e2587 commit d737620

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ext/bloom/bloom.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ func create(db *sqlite3.Conn, _, schema, table string, arg ...string) (_ *bloom,
7979

8080
t.bytes = numBytes(nelem, t.prob)
8181

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+
8288
err = db.Exec(fmt.Sprintf(
8389
`CREATE TABLE %s.%s (data BLOB, p REAL, n INTEGER, m INTEGER, k INTEGER)`,
8490
sqlite3.QuoteIdentifier(t.schema), sqlite3.QuoteIdentifier(t.storage)))
@@ -94,12 +100,6 @@ func create(db *sqlite3.Conn, _, schema, table string, arg ...string) (_ *bloom,
94100
VALUES (1, zeroblob(%d), %f, %d, %d, %d)`,
95101
sqlite3.QuoteIdentifier(t.schema), sqlite3.QuoteIdentifier(t.storage),
96102
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`)
103103
if err != nil {
104104
t.Destroy()
105105
return nil, err
@@ -198,10 +198,10 @@ func (t *bloom) Integrity(schema, table string, flags int) error {
198198
}
199199

200200
func (b *bloom) BestIndex(idx *sqlite3.IndexInfo) error {
201-
for n, cst := range idx.Constraint {
201+
for i, cst := range idx.Constraint {
202202
if cst.Usable && cst.Column == 1 &&
203203
cst.Op == sqlite3.INDEX_CONSTRAINT_EQ {
204-
idx.ConstraintUsage[n].ArgvIndex = 1
204+
idx.ConstraintUsage[i].ArgvIndex = 1
205205
idx.OrderByConsumed = true
206206
idx.EstimatedRows = 1
207207
idx.EstimatedCost = float64(b.hashes)

0 commit comments

Comments
 (0)