mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge pull request #1715 from tgruben/cleanup-query
addsql version to handler
This commit is contained in:
commit
f0b93da070
5 changed files with 15 additions and 3 deletions
|
|
@ -33,6 +33,9 @@ func (h HandlerFunc) HandleQuery(ctx context.Context, w pg.QueryResultWriter, q
|
|||
func (h HandlerFunc) HandleSchema(ctx context.Context, portal *pg.Portal) error {
|
||||
return nil
|
||||
}
|
||||
func (h HandlerFunc) Version() string {
|
||||
return "testv1"
|
||||
}
|
||||
|
||||
var _ pg.QueryHandler = HandlerFunc(nil)
|
||||
|
||||
|
|
|
|||
|
|
@ -432,7 +432,8 @@ func (p *Portal) Execute() (shouldTerminate bool, queryReady bool, err error) {
|
|||
return
|
||||
}
|
||||
p.Add(rowDescription)
|
||||
dataRow, _ := p.Encoder.TextRow("PostgresSQL 13.0 (molecula)")
|
||||
mesg := fmt.Sprintf("PostgresSQL 13.0 (molecula.%v)", p.server.QueryHandler.Version())
|
||||
dataRow, _ := p.Encoder.TextRow(mesg)
|
||||
p.Add(dataRow)
|
||||
case pgSelect1:
|
||||
rowDescription, e := p.Encoder.EncodeColumn("?column?", int32(23), 4)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ type QueryHandler interface {
|
|||
// HandleQuery executes a query and writes the results back.
|
||||
HandleQuery(context.Context, QueryResultWriter, Query) error
|
||||
HandleSchema(context.Context, *Portal) error
|
||||
Version() string
|
||||
}
|
||||
|
||||
// queryResultWriter implements QueryResultWrtiter over postgres wire protocol.
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import (
|
|||
"github.com/molecula/featurebase/v2/stats"
|
||||
"github.com/molecula/featurebase/v2/storage"
|
||||
"github.com/molecula/featurebase/v2/topology"
|
||||
"github.com/molecula/featurebase/v2/vprint"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
|
|
@ -1355,7 +1354,6 @@ func (s *Server) PlanSQL(ctx context.Context, q string) (*Stmt, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
vprint.VV("PLanning SQL: (%v)", q)
|
||||
return NewPlanner(s.executor).PlanStatement(ctx, st)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -596,7 +596,16 @@ func (qdh *QueryDecodeHandler) HandleQuery(ctx context.Context, w pg.QueryResult
|
|||
|
||||
return qdh.Child.HandleQuery(ctx, w, q)
|
||||
}
|
||||
func (qdh *QueryDecodeHandler) Version() string {
|
||||
return qdh.Child.Version()
|
||||
}
|
||||
|
||||
func (pqh *PilosaQueryHandler) Version() string {
|
||||
if pqh.sqlVersion > 0 {
|
||||
return "v2"
|
||||
}
|
||||
return "v1"
|
||||
}
|
||||
func (pqh *PilosaQueryHandler) HandleSchema(ctx context.Context, portal *pg.Portal) error {
|
||||
schema, err := pqh.Api.Schema(context.Background(), false)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue