Fix query
This commit is contained in:
parent
093cceeba1
commit
51a0623498
4
data.go
4
data.go
|
@ -75,7 +75,7 @@ type station struct {
|
|||
}
|
||||
|
||||
func findStations(db *sqlite.Conn, name string) (stations []*station, err error) {
|
||||
err = sqlitex.Exec(db, "select id, name, lat, lon from stations where name like '%' || ? || '%' order by name asc", func(stmt *sqlite.Stmt) error {
|
||||
err = sqlitex.Exec(db, "select id, name, lat, lon from stations where id = ? or ( name like '%' || ? || '%' and ? not in ( select id from stations ) ) order by name asc", func(stmt *sqlite.Stmt) error {
|
||||
stations = append(stations, &station{
|
||||
id: stmt.ColumnText(0),
|
||||
name: stmt.ColumnText(1),
|
||||
|
@ -83,7 +83,7 @@ func findStations(db *sqlite.Conn, name string) (stations []*station, err error)
|
|||
lon: stmt.ColumnFloat(3),
|
||||
})
|
||||
return nil
|
||||
}, name)
|
||||
}, name, name, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue