Fix influxql.Parse() references.

pull/1157/head
Ben Johnson 2014-11-25 08:48:10 -07:00
parent 21b02d1ec8
commit d78bc751c9
2 changed files with 11 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package influxdb_test
import (
"reflect"
"strings"
"testing"
"time"
@ -428,8 +429,8 @@ func TestDatabase_WriteSeries(t *testing.T) {
}
// mustParseQuery parses a query string into a query object. Panic on error.
func mustParseQuery(s string) influxql.Query {
q, err := influxql.Parse(s)
func mustParseQuery(s string) *influxql.Query {
q, err := influxql.NewParser(strings.NewReader(s)).ParseQuery()
if err != nil {
panic(err.Error())
}

View File

@ -3,6 +3,7 @@ package influxdb
import (
"encoding/json"
"net/http"
"strings"
"github.com/bmizerany/pat"
"github.com/influxdb/influxdb/influxql"
@ -98,7 +99,7 @@ func (h *Handler) serveQuery(w http.ResponseWriter, r *http.Request) {
// Parse query from query string.
values := r.URL.Query()
q, err := influxql.Parse(values.Get("q"))
_, err := influxql.NewParser(strings.NewReader(values.Get("q"))).ParseQuery()
if err != nil {
h.error(w, "parse error: "+err.Error(), http.StatusBadRequest)
return
@ -121,10 +122,12 @@ func (h *Handler) serveQuery(w http.ResponseWriter, r *http.Request) {
*/
// Execute query against the database.
if err := db.ExecuteQuery(q); err != nil {
h.error(w, err.Error(), http.StatusInternalServerError)
return
}
/*
if err := db.ExecuteQuery(q); err != nil {
h.error(w, err.Error(), http.StatusInternalServerError)
return
}
*/
}
// serveWriteSeries receives incoming series data and writes it to the database.