Updating vtable example, "BestIndex" method (#1099)

As it was, the vtable example will give an error when adding any kind of SQL constraint in the SQL statement. Updating the BestIndex method will ensure that adding SQL constraints will not result in errors

Signed-off-by: David Vassallo <davevassallo@gmail.com>

Signed-off-by: David Vassallo <davevassallo@gmail.com>
This commit is contained in:
David Vassallo 2022-10-19 02:04:52 +03:00 committed by GitHub
parent 0b3708425e
commit 4b8633cceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -63,7 +63,12 @@ func (v *ghRepoTable) Open() (sqlite3.VTabCursor, error) {
} }
func (v *ghRepoTable) BestIndex(cst []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) { func (v *ghRepoTable) BestIndex(cst []sqlite3.InfoConstraint, ob []sqlite3.InfoOrderBy) (*sqlite3.IndexResult, error) {
return &sqlite3.IndexResult{}, nil used := make([]bool, len(csts))
return &sqlite3.IndexResult{
IdxNum: 0,
IdxStr: "default",
Used: used,
}, nil
} }
func (v *ghRepoTable) Disconnect() error { return nil } func (v *ghRepoTable) Disconnect() error { return nil }