Skip to content

Commit

Permalink
Release v1.14.1
Browse files Browse the repository at this point in the history
- Fix a bug of dual table. ([GitHub #49](#49))
  • Loading branch information
mithrandie committed Mar 21, 2021
2 parents 69362c7 + dd0ca21 commit 53fa2a6
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## Version 1.14.1

Released on March 21, 2021

- Fix a bug of dual table. ([GitHub #49](https://github.com/mithrandie/csvq/issues/49))

## Version 1.14.0

Released on March 9, 2021
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/2006-01-02-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ Configuration Files are loaded in the following order.
Download a JSON file from [https://github.com/mithrandie/csvq/blob/master/csvq_env.json](https://github.com/mithrandie/csvq/blob/master/csvq_env.json) and put it to the above paths.
If the files exists in the multiple paths, then all existing files will be loaded and configuration items are overwritten with the values in the file that is loaded later.

#### Configuratin Items in JSON
#### Configuration Items in JSON

| Item | Format | default |
| :--- | :--- | :--- |
Expand Down
6 changes: 3 additions & 3 deletions docs/_posts/2006-01-02-string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ category: reference

| name | description |
| :- | :- |
| [TRIM](#trim) | Return a string with all leading and trailing characters removed |
| [LTRIM](#ltrim) | Return a string with all leading characters removed |
| [RTRIM](#rtrim) | Return a string with all trailing characters removed |
| [TRIM](#trim) | Return a string with all the specified leading and trailing characters removed |
| [LTRIM](#ltrim) | Return a string with all the specified leading characters removed |
| [RTRIM](#rtrim) | Return a string with all the specified trailing characters removed |
| [UPPER](#upper) | Return a string with all characters mapped to their upper case |
| [LOWER](#lower) | Return a string with all characters mapped to their lower case |
| [BASE64_ENCODE](#base64_encode) | Return a base64 encoding of a string |
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ title: Change Log - csvq

# Change Log

## Version 1.14.1

Released on March 21, 2021

- Fix a bug of dual table. ([GitHub #49](https://github.com/mithrandie/csvq/issues/49))

## Version 1.14.0

Released on March 9, 2021
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ In the multiple operations, you can use variables, cursors, temporary tables, an

## Latest Release

Version 1.14.0
: Released on March 9, 2021
Version 1.14.1
: Released on March 21, 2021

<a class="waves-effect waves-light btn" href="https://github.com/mithrandie/csvq/releases/tag/v1.14.0">
<a class="waves-effect waves-light btn" href="https://github.com/mithrandie/csvq/releases/tag/v1.14.1">
<i class="material-icons left">file_download</i>download
</a>

Expand Down
8 changes: 4 additions & 4 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://mithrandie.github.io/csvq/</loc>
<lastmod>2021-03-09T11:36:17+00:00</lastmod>
<lastmod>2021-03-21T20:12:10+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference.html</loc>
Expand All @@ -18,7 +18,7 @@
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/command.html</loc>
<lastmod>2021-03-09T10:34:59+00:00</lastmod>
<lastmod>2021-03-21T20:26:16+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/statement.html</loc>
Expand Down Expand Up @@ -150,7 +150,7 @@
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/string-functions.html</loc>
<lastmod>2019-07-06T02:12:43+00:00</lastmod>
<lastmod>2021-03-21T20:26:16+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/reference/numeric-functions.html</loc>
Expand Down Expand Up @@ -178,7 +178,7 @@
</url>
<url>
<loc>https://mithrandie.github.io/csvq/changelog.html</loc>
<lastmod>2021-03-09T11:36:17+00:00</lastmod>
<lastmod>2021-03-21T20:12:10+00:00</lastmod>
</url>
<url>
<loc>https://mithrandie.github.io/csvq/license.html</loc>
Expand Down
2 changes: 1 addition & 1 deletion lib/query/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (h Header) ContainsObject(obj parser.QueryExpression) (int, bool) {
continue
}

if !strings.EqualFold(f.Column, column) {
if (f.Number < 1 && len(f.Column) < 1) || !strings.EqualFold(f.Column, column) {
continue
}

Expand Down
11 changes: 11 additions & 0 deletions lib/query/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ func TestHeader_ContainsObject(t *testing.T) {
t.Errorf("%s: index = %d, want %d", v.Expr.String(), result, v.Result)
}
}

dual := NewDualView()
expr := parser.NewStringValue("")

result, ok := dual.Header.ContainsObject(expr)
if ok != false {
t.Errorf("%s: contains flag = %t, want %t", "<empty string>", ok, false)
}
if result != -1 {
t.Errorf("%s: index = %d, want %d", "<empty string>", result, -1)
}
}

var headerFieldNumberIndexTests = []struct {
Expand Down
2 changes: 1 addition & 1 deletion lib/query/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package query

var Version = "v1.14.0"
var Version = "v1.14.1"
4 changes: 2 additions & 2 deletions lib/query/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func loadView(ctx context.Context, scope *ReferenceScope, tableExpr parser.Query

switch table.Object.(type) {
case parser.Dual:
view = loadDualView()
view = NewDualView()
case parser.TableObject:
tableObject := table.Object.(parser.TableObject)
options := scope.Tx.Flags.ImportOptions.Copy()
Expand Down Expand Up @@ -1069,7 +1069,7 @@ func loadViewFromJsonFile(fp io.Reader, fileInfo *FileInfo, expr parser.QueryExp
return view, nil
}

func loadDualView() *View {
func NewDualView() *View {
return &View{
Header: NewEmptyHeader(1),
RecordSet: RecordSet{NewEmptyRecord(1)},
Expand Down

0 comments on commit 53fa2a6

Please sign in to comment.