Encode sql query to base64 for CSV export, GH-95

This commit is contained in:
Dan Sosedoff
2015-08-15 20:53:51 -05:00
parent 2a4edaf08f
commit c02d15ec34
3 changed files with 13 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package api
import (
"encoding/base64"
"errors"
"fmt"
"strconv"
@@ -174,8 +175,12 @@ func GetTableIndexes(c *gin.Context) {
}
func HandleQuery(query string, c *gin.Context) {
result, err := DbClient.Query(query)
rawQuery, err := base64.StdEncoding.DecodeString(query)
if err == nil {
query = string(rawQuery)
}
result, err := DbClient.Query(query)
if err != nil {
c.JSON(400, NewError(err))
return