Skip to content

Commit

Permalink
Release v0.2.12
Browse files Browse the repository at this point in the history
Fix some bugs.
  • Loading branch information
mithrandie committed Jul 10, 2017
2 parents 716fd29 + 6d0fe07 commit 7103b5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 2 additions & 4 deletions lib/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,8 @@ func DeclareTable(expr parser.TableDeclaration) error {
return err
}

if expr.Fields != nil {
if err := view.UpdateHeader(expr.Table.Literal, expr.Fields); err != nil {
return err
}
if err := view.UpdateHeader(expr.Table.Literal, expr.Fields); err != nil {
return err
}
} else {
fields := make([]string, len(expr.Fields))
Expand Down
13 changes: 8 additions & 5 deletions lib/query/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,6 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie
case parser.Dual:
view = loadDualView()
case parser.Stdin:
if !isReadableFromStdin() {
return nil, errors.New("stdin is empty")
}

delimiter := cmd.GetFlags().Delimiter
if delimiter == cmd.UNDEF {
delimiter = ','
Expand All @@ -284,9 +280,13 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie
}

if _, ok := ViewCache.Exists(fileInfo.Path); !ok {
if !isReadableFromStdin() {
return nil, errors.New("stdin is empty")
}

file := os.Stdin
defer file.Close()
if err := loadViewFromFile(file, fileInfo, table.Name()); err != nil {
if err := loadViewFromFile(file, fileInfo, STDIN_VIRTUAL_FILE_PATH); err != nil {
return nil, err
}
} else {
Expand All @@ -299,6 +299,9 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie
} else {
view, _ = ViewCache.Get(fileInfo.Path)
}
if STDIN_VIRTUAL_FILE_PATH != table.Name() {
view.UpdateHeader(table.Name(), nil)
}
case parser.Identifier:
tableIdentifier := table.Object.(parser.Identifier).Literal
if strings.EqualFold(tableIdentifier, parentFilter.RecursiveTable.Name.Literal) && parentFilter.RecursiveTmpView != nil {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/urfave/cli"
)

var version = "v0.2.11"
var version = "v0.2.12"

func main() {
cli.AppHelpTemplate = appHHelpTemplate
Expand Down

0 comments on commit 7103b5b

Please sign in to comment.